1. Nachrichten
  2. Forum
    1. Unerledigte Themen
    2. Forenregeln
  3. Spenden
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. camp-firefox.de
  2. loshombre

Beiträge von loshombre

  • userChrome.js Scripte für den Fuchs (Zusammenstellung)

    • loshombre
    • 5. Juni 2011 um 00:09

    27. Vertikal Toolbar // Eine interessante Nummer für die Besitzer von Wildscreens, oder je nach Bedarf auch für kleinere Bildschirme. Das Script zaubert eine neue zusätzliche vertikale Toolbar, mit vordefinierten, gängigen Fuchsoptionen (Lesezeichen, Chronik, neues Fenster/Tab, Downloads, Kopieren, Einfügen, Drucken, ect....). Die Reihenfolge, Browserposition: links, rechst, oben, unten, geteilt (in diesem Beispiel: Toolbar links, geteilt, große Buttons [Siehe Beispielbild unten]) der Optionen kann im Script verändert werden. Wenn man noch was anderes haben will, kann man es natürlich dazu packen. Nur wie diese Option in der Scriptsprache des Fuchses genannt wird, sollte man wissen. Da kann u.a. der DOMI weiter helfen. Je nach Bedarf können auch noch große, oder kleine Buttons, nur Text, oder alles komplett ausgewählt werden.

    [Blockierte Grafik: http://img7.imagebanana.com/img/th0g08sg/thumb/Zwischenablage02.jpg]

  • userChrome.js Scripte für Fuchs 16 (Zusammenstellung) alt

    • loshombre
    • 5. Juni 2011 um 00:09

    27. Vertikal Toolbar // Eine interessante Nummer für die Besitzer von Wildscreens, oder je nach Bedarf auch für kleinere Bildschirme. Das Script zaubert eine neue zusätzliche vertikale Toolbar, mit vordefinierten, gängigen Fuchsoptionen (Lesezeichen, Chronik, neues Fenster/Tab, Downloads, Kopieren, Einfügen, Drucken, ect....). Die Reihenfolge, Browserposition: links, rechst, oben, unten, geteilt (in diesem Beispiel: Toolbar links, geteilt, große Buttons [Siehe Beispielbild unten]) der Optionen kann im Script verändert werden. Wenn man noch was anderes haben will, kann man es natürlich dazu packen. Nur wie diese Option in der Scriptsprache des Fuchses genannt wird, sollte man wissen. Da kann u.a. der DOMI weiter helfen. Je nach Bedarf können auch noch große, oder kleine Buttons, nur Text, oder alles komplett ausgewählt werden.

    [Blockierte Grafik: http://img7.imagebanana.com/img/th0g08sg/thumb/Zwischenablage02.jpg]

  • userChrome.js Scripte für Fuchs 14 (Zusammenstellung)

    • loshombre
    • 5. Juni 2011 um 00:09

    27. Vertikal Toolbar // Eine interessante Nummer für die Besitzer von Wildscreens, oder je nach Bedarf auch für kleinere Bildschirme. Das Script zaubert eine neue zusätzliche vertikale Toolbar, mit vordefinierten, gängigen Fuchsoptionen (Lesezeichen, Chronik, neues Fenster/Tab, Downloads, Kopieren, Einfügen, Drucken, ect....). Die Reihenfolge, Browserposition: links, rechst, oben, unten, geteilt (in diesem Beispiel: Toolbar links, geteilt, große Buttons [Siehe Beispielbild unten]) der Optionen kann im Script verändert werden. Wenn man noch was anderes haben will, kann man es natürlich dazu packen. Nur wie diese Option in der Scriptsprache des Fuchses genannt wird, sollte man wissen. Da kann u.a. der DOMI weiter helfen. Je nach Bedarf können auch noch große, oder kleine Buttons, nur Text, oder alles komplett ausgewählt werden.

    [Blockierte Grafik: http://img7.imagebanana.com/img/th0g08sg/thumb/Zwischenablage02.jpg]

  • [Erledigt] Bild in Erweiterung mit Stylish Script ausblenden

    • loshombre
    • 4. Juni 2011 um 20:29
    Zitat

    PS was nicht verhindert wird, sind die Webbugs in einigen Erweiterungen.
    Also Grafiken, die per Erweiterung vom Server geladen werden und so einer Statistik fröhnen,

    Tja, ist nun mal halt so Hombre.

    Ich vergaß bei der chrome url beim schreiben noch ein dta. Hast den Fehler aber selber korrigieren können. Passt also, obwohl es dort diesen Ordner nur ein mal gibt. Aber wenn es funktioniert, wen kümmert´s dann noch :wink:

  • [Erledigt] Bild in Erweiterung mit Stylish Script ausblenden

    • loshombre
    • 4. Juni 2011 um 15:29

    Könnte vielleicht so gehen:
    @namespace url(http://www.mozilla.org/keymaster/gate…ere.is.only.xul);
    @-moz-document url-prefix(chrome://dta/content/manager.xul) {

    Eventuell auch mal ohne -prefix probieren.

  • Google-Übersetzer als Suche

    • loshombre
    • 3. Juni 2011 um 00:40

    Danke Hombre. Das sack ich für die Platte ein.

  • Google-Übersetzer als Suche

    • loshombre
    • 2. Juni 2011 um 22:53

    http://mycroft.mozdev.org/search-engines…ranslate.google

  • Code gesucht: Löschen der History des aktuellen Tabs

    • loshombre
    • 2. Juni 2011 um 00:39

    Versuch das mal mit der userchrome.js

  • Code gesucht: Löschen der History des aktuellen Tabs

    • loshombre
    • 31. Mai 2011 um 23:10

    Vielleicht ist das was für dich.

  • userChrome.js Scripte für den Fuchs (Zusammenstellung)

    • loshombre
    • 29. Mai 2011 um 22:13

    Ja, schon klar. Es geht nur darum, dass der hier kopierte Javascript bei anderen auf einmal nicht funktionieren wollte, weil die Forumsoftware irgendwie das Format durcheinander brachte.
    Aber wir können es mal gerne versuchen:

    1. Auto Copy (Javascript):

    Code
    /* Auto Copy */
    
    
    var gautocopy_lastSelection = null;
    var gautocopy_hidemenu_timer = null;
    var gautocopy_clipboardcontents = new Array();
    var gautocopy_doPaste = false;
    
    
    window.addEventListener("load",function() {initAutoCopyStatus();} ,false);
    window.addEventListener("focus",function() {resetAutoCopyStatus();} ,false);
    
    
    window.addEventListener("mouseup", autocopyOnMouseUp ,false);
    window.addEventListener("keyup", autocopy_onKeyUpCheck ,false);
    
    
    //window.onmouseup = autocopyOnMouseUp;
    //window.onkeyup = autocopy_onKeyUpCheck;
    
    
    window.addEventListener("mousedown", Autocopy_Pasteonmiddleclick_mousedown ,false);
    window.addEventListener("mouseup", Autocopy_Pasteonmiddleclick_mouseup ,false);
    
    
    
    
    // prefs
    var autocopyPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("autocopy.");
    
    
    if (!autocopyPrefs.prefHasUserValue("StatusBarState"))
    	autocopyPrefs.setIntPref("StatusBarState", 1)
    
    
    
    
    
    
    
    
    function AutocopyClipboardContents(adataType, adata, adataLength)
    {
    	this.dataType = adataType;
    	this.data = adata;
    	this.dataLength = adataLength;
    }
    
    
    
    
    function autocopyContextHide(e) {
    
    
    	var cm = gContextMenu;
    	var AutocopyFirebirdcontextmenuitem = document.getElementById('autocopy-firebirdcontextmenuitem');
    
    
    	if(autocopyPrefs.getBoolPref("optContextMenuItem")){
    		AutocopyFirebirdcontextmenuitem.hidden = ( cm.onImage );
    		//|| cm.onLink || cm.onImage || cm.onTextInput );
    	}
    	else{
    	    AutocopyFirebirdcontextmenuitem.hidden = true;
    	}
    
    
    	if(AutocopyFirebirdcontextmenuitem.hidden)
    	{
    		document.getElementById('autocopy-firebirdcontextmenuitemseparator').hidden = true;
    	}
    	else
    	{
    		document.getElementById('autocopy-firebirdcontextmenuitemseparator').hidden = false;
    		autocopy_context_onpopupshowing(e);
    	}
    }
    
    
    
    
    function setAutoCopyStatus()
    {
    	if(autocopyPrefs.getBoolPref("optStatusBar")){
    		var autocopy = document.getElementById('autocopy-status');
    		var autocopystatusimage = document.getElementById('autocopy-status-image');
    		var tooltip = document.getElementById('autocopy-tooltip-value');
    
    
    		if(autocopy && autocopystatusimage)
    		{
    			autocopystatusimage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    		    	var strings = document.getElementById("autocopyStrings");
    			tooltip.setAttribute("value", strings.getString("statusbar-tooltip-enabled"));
    		}
    	}
    
    
    }
    
    
    
    
    
    
    function initAutoCopyStatus() 
    {
    	initPreferences();
    
    	document.getElementById("cmd_selectAll").setAttribute("oncommand", "goDoCommand('cmd_selectAll'); AutocopySelectAll();");
    
    
        	var strings = document.getElementById("autocopyStrings");
    
    
    	var autocopyLocalizationPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.{0FED7D55-65D4-47b6-A6DE-9A4ADB55355F}.");
    	var autocopylocaledescription = strings.getString("autocopy-description");
    	var str = Components.classes[ "@mozilla.org/supports-string;1" ].createInstance( Components.interfaces.nsISupportsString );
    	str.data = autocopylocaledescription;
    	autocopyLocalizationPrefs.setComplexValue( "description", Components.interfaces.nsISupportsString, str );
    
    
    
    	var autocopyStatusBarButtonPanel = document.getElementById('autocopy-statuspanel');
    	var autocopyStatusBarButton = document.getElementById('autocopy-status');
    	var autocopyStatusBarButtonImage = document.getElementById('autocopy-status-image');
    	var autocopyStatusBarButtonTooltip = document.getElementById('autocopy-tooltip-value');
    	if(autocopyStatusBarButton && autocopyStatusBarButtonImage)
    	{
    
    
    		if(autocopyPrefs.getBoolPref("optStatusBar")){
            	    if(autocopyStatusBarButtonPanel.collapsed)
    		    {
            	    	   autocopyStatusBarButtonPanel.collapsed = false;
    		    }
            	}
            	else{
            	    if(!autocopyStatusBarButtonPanel.collapsed)
    		    {
            	    	   autocopyStatusBarButtonPanel.collapsed = true;
    		    }
            	}
    
    
    
    		if (autocopyPrefs.getIntPref("StatusBarState") == 0)
    	        {
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    		                 autocopyStatusBarButton.setAttribute("status", "disabled");
    					autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyDisabled.png");
    	        	         autocopyStatusBarButtonTooltip.setAttribute("value", strings.getString("statusbar-tooltip-disabled"));
    	        	 }
    		}
    		else
    		{
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    	                 	autocopyStatusBarButton.setAttribute("status", "enabled");
    				autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    	                 	autocopyStatusBarButtonTooltip.setAttribute("value", strings.getString("statusbar-tooltip-enabled"));
    			 }
    		}
    
    
    	}
    
    
    
    
    
    
    
    
    	var AutocopyFirebirdmenuitem = document.getElementById('autocopy-firebirdmenuitem');
    	var AutocopyFirebirdmenuitemseparator = document.getElementById('autocopy-firebirdmenuitemseparator');
    	if(AutocopyFirebirdmenuitem)
    	{
    		if (autocopyPrefs.getIntPref("StatusBarState") == 0)
    	        {
    	                 AutocopyFirebirdmenuitem.setAttribute("checked", false);
    		}
    		else
    		{
    	                 AutocopyFirebirdmenuitem.setAttribute("checked", true);
    		}
    
    
    	        if(autocopyPrefs.getBoolPref("optEditMenuItem")){
    		    AutocopyFirebirdmenuitemseparator.setAttribute("hidden", false);
    	            AutocopyFirebirdmenuitem.setAttribute("hidden", false);
    	        }
    	        else{
    		    AutocopyFirebirdmenuitemseparator.setAttribute("hidden", true);
    	            AutocopyFirebirdmenuitem.setAttribute("hidden", true);
    	        }
    	}
    
    
    	var AutocopyFirebirdcontextmenuitem = document.getElementById('autocopy-firebirdcontextmenuitem');
    	if(AutocopyFirebirdcontextmenuitem)
    	{
    
    		if(document.getElementById("contentAreaContextMenu"))
    		{
    			document.getElementById("contentAreaContextMenu").addEventListener("popupshowing",autocopyContextHide,false);
    	        }	
    	}
    
    
    
    
    	var Autocopykeytoggleautocopyenabled = null;
    	if(document.getElementById('firebirdkey-toggle-autocopyenabled'))
    		Autocopykeytoggleautocopyenabled = document.getElementById('firebirdkey-toggle-autocopyenabled');
    	if(document.getElementById('mozillakey-toggle-autocopyenabled'))
    		Autocopykeytoggleautocopyenabled = document.getElementById('mozillakey-toggle-autocopyenabled');
    	if(document.getElementById('thunderbirdkey-toggle-autocopyenabled'))
    		Autocopykeytoggleautocopyenabled = document.getElementById('thunderbirdkey-toggle-autocopyenabled');
    
    
    	if(Autocopykeytoggleautocopyenabled)
    	{
    	        if(autocopyPrefs.getBoolPref("optKeyboardShortcutEnabled")){
    
    	            var optModifiers = "";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyAccel"))
    	                optModifiers = optModifiers + ",accel";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyMeta"))
    	                optModifiers = optModifiers + ",meta";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyCtrl"))
    	                optModifiers = optModifiers + ",control";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyShift"))
    	                optModifiers = optModifiers + ",shift";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyAlt"))
    	                optModifiers = optModifiers + ",alt";
    
    	            optModifiers.replace(/^\,/,"");
    
    	            var optKey = autocopyPrefs.getCharPref("optKeyboardShortcutKey");
    	            if(optKey.match(/^[A-Z]$/i)){
    	                Autocopykeytoggleautocopyenabled.setAttribute("key", optKey);
    	                Autocopykeytoggleautocopyenabled.setAttribute("keycode", "");
    	            }
    	            else{
    	                Autocopykeytoggleautocopyenabled.setAttribute("key", "");
    	                Autocopykeytoggleautocopyenabled.setAttribute("keycode", optKey);
    	            }
    
    	            Autocopykeytoggleautocopyenabled.setAttribute("modifiers", optModifiers);
    	            Autocopykeytoggleautocopyenabled.setAttribute("disabled", false);
    	        }
    	        else{
    	            Autocopykeytoggleautocopyenabled.setAttribute("disabled", true);
    	        }
    	}
    
    
    
    
    	PasteOnMiddleClickStatusbarOption =  document.getElementById('autocopy-statusbar-PasteOnMiddleClick');
    	if(PasteOnMiddleClickStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	EnableInTextBoxesStatusbarOption =  document.getElementById('autocopy-statusbar-EnableInTextBoxes');
    	if(EnableInTextBoxesStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    		{
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	AutocopyContextMenuStatusbarOption =  document.getElementById('autocopy-statusbar-AutocopyContextMenu');
    	if(AutocopyContextMenuStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optContextMenu"))
    		{
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	StatusbarBlinkStatusbarOption =  document.getElementById('autocopy-statusbar-StatusbarBlink');
    	if(StatusbarBlinkStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optStatusbarBlink"))
    		{
    			StatusbarBlinkStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			StatusbarBlinkStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	StatusbarDeselectAfterCopy =  document.getElementById('autocopy-statusbar-DeselectAfterCopy');
    	if(StatusbarDeselectAfterCopy)
    	{
    		if (autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    		{
    			StatusbarDeselectAfterCopy.setAttribute("checked", true);
    		}
    		else
    		{
    			StatusbarDeselectAfterCopy.setAttribute("checked", false);
    		}
    	}
    
    
    
    
    
    
    
    
    }
    
    
    /////////////////
    //
    //window.addEventListener("load",function() {AutoCopyCopyOnLoad();} ,true);
    //
    //function AutoCopyCopyOnLoad()
    //{
    //////////////////
    //goDoCommand('cmd_selectAll');
    //AutocopySelectAll();
    //Autocopy_DeselectAfterCopy_CollapseSelection()
    //}
    /////////////////
    
    
    function resetAutoCopyStatus()
    {
        initAutoCopyStatus()
    }
    
    
    
    
    function initPreferences(){
    
    
    	if (!autocopyPrefs.prefHasUserValue("StatusBarState"))
    		autocopyPrefs.setIntPref("StatusBarState", 1)
    
    
    	if (!autocopyPrefs.prefHasUserValue("optPasteOnMiddleClick"))
    		autocopyPrefs.setBoolPref("optPasteOnMiddleClick", true);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optDeselectAfterCopy"))
    	{
    		if(navigator.vendor.match(/Thunderbird/i))
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", false);
    		}
    	}
    
    
    
    
    	if (!autocopyPrefs.prefHasUserValue("optCopyWithoutFormating"))
    		autocopyPrefs.setBoolPref("optCopyWithoutFormating", false);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optStatusBar"))
    		autocopyPrefs.setBoolPref("optStatusBar", true);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optStatusbarBlink"))
    		autocopyPrefs.setBoolPref("optStatusbarBlink", true);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optContextMenu"))
    		autocopyPrefs.setBoolPref("optContextMenu", false);
    
    
    
    
    	if (!autocopyPrefs.prefHasUserValue("optContextMenuHideTimeout"))
    		autocopyPrefs.setIntPref("optContextMenuHideTimeout", 2000);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optEditMenuItem"))
    		autocopyPrefs.setBoolPref("optEditMenuItem", false);
    	if (!autocopyPrefs.prefHasUserValue("optContextMenuItem"))
    		autocopyPrefs.setBoolPref("optContextMenuItem", true);
    	if (!autocopyPrefs.prefHasUserValue("optEnableInTextBoxes"))
    		autocopyPrefs.setBoolPref("optEnableInTextBoxes", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutEnabled"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutEnabled", false);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyAccel"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyAccel", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyMeta"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyMeta", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyCtrl"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyCtrl", true);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyShift"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyShift", true);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyAlt"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyAlt", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKey"))
    		autocopyPrefs.setCharPref("optKeyboardShortcutKey", "C");
    }
    
    
    
    
    
    
    
    
    function switchautocopystatusstate()
    {
            if (autocopyPrefs.getIntPref("StatusBarState") == 0)
            {
    		autocopyPrefs.setIntPref("StatusBarState", 1);
            }
            else
            {
    		autocopyPrefs.setIntPref("StatusBarState", 0);
            }
            initAutoCopyStatus();
    }
    
    
    function autocopy_onKeyUpCheck(e)
    {
    	if(e.keyCode == e.DOM_VK_A && e.ctrlKey)
    	{
    		autocopyOnMouseUp(e);
    	}
    }
    
    
    
    
    function autocopyOnMouseUp(e)
    {
       if ((!e.ctrlKey) || (e.keyCode))
       {
    	var targetclassname = e.target.toString();
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    		if(!targetclassname.match(/SelectElement|OptionElement/i))
    		{
    			if(!Autocopy_isTargetEditable(e.target))
    			{
    				if (!targetclassname.match(/object XUL/i))
    				{
    
    
    					if((autocopy_getSelection().length > 0) && (gautocopy_lastSelection != autocopy_getSelection()))
    					{
    						//were going to copy
    						gautocopy_lastSelection = autocopy_getSelection();
    						autocopy_saveclipboard();
    						if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    						{
    							copyplaintext();
    						}
    						else
    						{
    							goDoCommand('cmd_copy');
    						}
    						if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    						{
    							AutocopyBlinkStatusbarButton(3);
    						}
    						if (autocopyPrefs.getBoolPref("optContextMenu"))
    						{
    							var x = e.screenX;
    							var y = e.screenY;
    							if(x == 0 && y == 0)
    							{
    								document.popupNode = document.documentElement;
    								document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    								autocopy_timedhidemenu(); 
    							}
    							else
    							{
    								document.popupNode = null;
    								document.getElementById('autocopy-context-menu').showPopup(document.documentElement, x, y, "context");
    								autocopy_timedhidemenu(); 
    							}
    						}
    						if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    						{
    							Autocopy_DeselectAfterCopy();
    						}
    					}
    				}
    			}
    			else if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    			{
    				if((autocopy_getSelection().length > 0) && (gautocopy_lastSelection != autocopy_getSelection()))
    				{
    					//were going to copy
    					gautocopy_lastSelection = autocopy_getSelection();
    					autocopy_saveclipboard();
    					if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    					{
    						//copyplaintext dosn't work in textboxes
    						//copyplaintext();
    						goDoCommand('cmd_copy');
    					}
    					else
    					{
    						goDoCommand('cmd_copy');
    					}
    					if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    					{
    						AutocopyBlinkStatusbarButton(3);
    					}
    					if (autocopyPrefs.getBoolPref("optContextMenu"))
    					{
    						var x = e.screenX;
    						var y = e.screenY;
    						if(x == 0 && y == 0)
    						{
    							document.popupNode = document.documentElement;
    							document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    							autocopy_timedhidemenu(); 
    						}
    						else
    						{
    							document.popupNode = null;
    							document.getElementById('autocopy-context-menu').showPopup(document.documentElement, x, y, "context");
    							autocopy_timedhidemenu(); 
    						}
    					}
    					if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    					{
    						Autocopy_DeselectAfterCopy();
    					}
    				}
    			}
    		}
       	}
       }
    }
    
    
    
    
    function AutocopySelectAll()
    {
    	var targetclassname = "";
    	if(document.commandDispatcher.focusedElement)
    	{	
    		targetclassname = document.commandDispatcher.focusedElement.toString();
    	}
    
    
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    //		if (!targetclassname.match(/object XUL/i))
    //		{
    			if(!targetclassname.match(/SelectElement|OptionElement/i))
    			{
    				if(!Autocopy_isTargetEditableDispatcher(document.commandDispatcher))
    				{
    					if(autocopy_getSelection().length > 0)
    					{
    						//were going to copy
    						gautocopy_lastSelection = autocopy_getSelection();
    						autocopy_saveclipboard();
    						if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    						{
    							copyplaintext();
    						}
    						else
    						{
    							goDoCommand('cmd_copy');
    						}
    						if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    						{
    							AutocopyBlinkStatusbarButton(3);
    						}
    						if (autocopyPrefs.getBoolPref("optContextMenu"))
    						{
    							document.popupNode = document.documentElement;
    							document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    							autocopy_timedhidemenu(); 
    						}
    						if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    						{
    							Autocopy_DeselectAfterCopy();
    						}
    					}
    				}
    				else if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    				{
    					if((autocopy_getSelection().length > 0) && (gautocopy_lastSelection != autocopy_getSelection()))
    					{
    						gautocopy_lastSelection = autocopy_getSelection();
    						autocopy_saveclipboard();
    						if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    						{
    							//copyplaintext dosn't work in textboxes
    							//copyplaintext();
    							goDoCommand('cmd_copy');
    						}
    						else
    						{
    							goDoCommand('cmd_copy');
    						}
    						if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    						{
    							AutocopyBlinkStatusbarButton(3);
    						}
    						if (autocopyPrefs.getBoolPref("optContextMenu"))
    						{
    								document.popupNode = document.documentElement;
    								document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    								autocopy_timedhidemenu(); 
    						}
    						if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    						{
    							Autocopy_DeselectAfterCopy();
    						}
    					}
    				}
    			}
    //		}
    	}
    }
    
    
    
    
    function Autocopy_Pasteonmiddleclick_mousedown(e)
    {
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    		if((!e.ctrlKey) && autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			if(e.button == 1)
    			{
    				gautocopy_doPaste = false;	
    
    
    				if(e.target.inputField)
    				{
    					if(e.target.inputField.toString().match(/InputElement|TextAreaElement/i))
    					{
    						gautocopy_doPaste = true;
    					}
    				}	
    				if(e.target.mTextbox)
    				{
    					if(e.target.mTextbox.inputField)
    					{
    						if(e.target.mTextbox.inputField.toString().match(/InputElement|TextAreaElement/i))
    						{
    							gautocopy_doPaste = true;
    						}
    					}
    				}
    				if(Autocopy_isTargetEditable(e.target))
    				{
    					gautocopy_doPaste = true;
    				}
    
    				if(gautocopy_doPaste)
    				{
    					if (getBrowser().mCurrentBrowser.autoscrollEnabled) 
    					{
    						getBrowser().mCurrentBrowser._autoScrollPopup.hidePopup();
    						getBrowser().mCurrentBrowser.stopScroll();
    					}
    				}
    			}
    		}
    	}	
    }
    function Autocopy_Pasteonmiddleclick_mouseup(e)
    {
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    		if((!e.ctrlKey) && autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			if(e.button == 1)
    			{
    				if(gautocopy_doPaste)
    				{
    					goDoCommand('cmd_paste');
    					if (getBrowser().mCurrentBrowser.autoscrollEnabled) 
    					{
    						getBrowser().mCurrentBrowser._autoScrollPopup.hidePopup();
    						getBrowser().mCurrentBrowser.stopScroll();
    					}
    				}
    			}
    		}
    	}	
    }
    
    
    
    
    
    
    
    
    function Autocopy_isTargetEditable(target)
    {
    if(target)
    {
      if(target.toString().match(/InputElement|TextAreaElement/i))
      {
        return true;
      }
    
    
      if(target.textbox)
      {
        return true;
      }
    
    
      if(target.ownerDocument)
      {
        if(target.ownerDocument.designMode)
        {
          if(target.ownerDocument.designMode.match(/on/i))
          {
            return true;
          }
        }
      }
    }
    return false;
    }
    
    
    
    
    
    
    
    
    function Autocopy_isTargetEditableDispatcher(commandDispatcher)
    {
    
    
    	
    	if(commandDispatcher.focusedElement)
    	{
    		if(commandDispatcher.focusedElement.toString().match(/InputElement|TextAreaElement/i))
    		{
    			return true;
    		}
    	}
    	else
    	{
    		if(commandDispatcher.focusedWindow.document.designMode)
    		{
    			if(commandDispatcher.focusedWindow.document.designMode.match(/on/i))
    			{
    				return true;
    			}
    		}
    	}
    
    
    	return false;
    }
    
    
    function Autocopy_DeselectAfterCopy()
    {
    
    
    	if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    	{
    		var focusedElement = document.commandDispatcher.focusedElement;
    		if(focusedElement)
    		{
    			SelectionLength = focusedElement.selectionEnd - focusedElement.selectionStart;
    			Autocopy_DeselectAfterCopy_CollapseSelection_TextBox()
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection_TextBox, 25, SelectionLength); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection_TextBox, 50); 
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection_TextBox, 75, SelectionLength); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection_TextBox, 100); 	
    		}
    		else
    		{
    			var focusedWindow = document.commandDispatcher.focusedWindow;
    			try
    			{
    				var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    				var Selection = winWrapper.getSelection();
    			}
    			catch(e)
    			{
    				var Selection = focusedWindow.getSelection();
    			}
    			var SelectionfocusNode = Selection.focusNode;
    			var SelectionfocusOffset = Selection.focusOffset;
    			Autocopy_DeselectAfterCopy_CollapseSelection()
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection, 25, SelectionfocusNode, SelectionfocusOffset); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection, 50); 
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection, 75, SelectionfocusNode, SelectionfocusOffset); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection, 100); 	
    		}
    	}
    	else
    	{	
    		var focusedElement = document.commandDispatcher.focusedElement;
    		if(focusedElement)
    		{		
    			Autocopy_DeselectAfterCopy_CollapseSelection_TextBox()
    		}
    		else
    		{
    			goDoCommand('cmd_selectNone');
    		}
    	}
    }
    function Autocopy_DeselectAfterCopy_ExtendSelection_TextBox(SelectionLength)
    {
    	var focusedElement = document.commandDispatcher.focusedElement;
    	if(focusedElement)
    	{
    		focusedElement.selectionEnd = focusedElement.selectionStart + SelectionLength;
    	}
    }
    function Autocopy_DeselectAfterCopy_CollapseSelection_TextBox()
    {
    	var focusedElement = document.commandDispatcher.focusedElement;
    	if(focusedElement)
    	{
    		focusedElement.selectionEnd = focusedElement.selectionStart;
    	}
    }
    function Autocopy_DeselectAfterCopy_ExtendSelection(SelectionfocusNode, SelectionfocusOffset)
    {
    	var focusedWindow = document.commandDispatcher.focusedWindow;
    	try
    	{
    		var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    		var Selection = winWrapper.getSelection();
    	}
    	catch(e)
    	{
    		var Selection = focusedWindow.getSelection();
    	}
    	Selection.extend(SelectionfocusNode, SelectionfocusOffset);
    }
    function Autocopy_DeselectAfterCopy_CollapseSelection()
    {
    	var focusedWindow = document.commandDispatcher.focusedWindow;
    	try
    	{
    		var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    		var Selection = winWrapper.getSelection();
    	}
    	catch(e)
    	{
    		var Selection = focusedWindow.getSelection();
    	}
    	var SelectionanchorNode = Selection.anchorNode;
    	var SelectionanchorOffset = Selection.anchorOffset;
    	Selection.collapse(SelectionanchorNode, SelectionanchorOffset);
    }
    
    
    
    
    
    
    function AutocopyBlinkStatusbarButton(numberofblinks)
    {
    	setTimeout(AutocopyBlinkStatusbarButton, 5000, 0); //resets in 5 seconds just incase
    
    
    	var autocopyStatusBarButton = document.getElementById('autocopy-status');
    	var autocopyStatusBarButtonImage = document.getElementById('autocopy-status-image');
    	var autocopyStatusBarButtonTooltip = document.getElementById('autocopy-tooltip-value');
    	if (numberofblinks > 0)
    	{
    		if (autocopyPrefs.getIntPref("StatusBarState") != 0)
    		{
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    				if(autocopyStatusBarButtonImage.getAttribute("src") == "chrome://autocopy/skin/AutoCopyEnabled.png")
    				{
    					autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyBlank.png");
    				}
    				else
    				{
    					autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    				}
    				numberofblinks = numberofblinks - 1;
    		     		setTimeout(AutocopyBlinkStatusbarButton, 300, numberofblinks);
    			 }
    		}
    	}
    	else
    	{
    		if (autocopyPrefs.getIntPref("StatusBarState") != 0)
    		{
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    				autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    			 }
    		}
    	}
    }
    
    
    
    
    function autocopy_getSelection() 
    {
    	var SelectionText = "";
    	var trywindow = false;
    
    	var focusedElement = document.commandDispatcher.focusedElement;
    	if(focusedElement && null != focusedElement)
    	{
    		try
    		{
    			SelectionText = focusedElement.value.substring(focusedElement.selectionStart, focusedElement.selectionEnd);
    		}
    		catch(e)
    		{
    			trywindow = true;
    		}
    	}
    	else
    	{
    		trywindow = true;
    	}
    
    	if(trywindow)
    	{
    		var focusedWindow = document.commandDispatcher.focusedWindow;
    		try
    		{
    			var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    			var Selection = winWrapper.getSelection();
    		}
    		catch(e)
    		{
    			var Selection = focusedWindow.getSelection();
    		}
    		SelectionText = Selection.toString();
    
    
    	}
    	return SelectionText;
    }
    
    
    function autocopy_getClipboardContents()
    {
    	var clip = Components.classes["@mozilla.org/widget/clipboard;1"].
                 getService(Components.interfaces.nsIClipboard);
    	if (!clip) return false;
    
    
    	var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    	if (!trans) return false;
    		trans.addDataFlavor("text/unicode");
    
    
    	clip.getData(trans,clip.kGlobalClipboard);
    
    
    	var str = new Object();
    	var strLength = new Object();
    
    
    	try{
    		trans.getTransferData("text/unicode",str,strLength);
    	}
    	catch(e){	
    		return false;
    	}
    	if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
    	if (str) pastetext = str.data.substring(0,strLength.value / 2);
    
    	return pastetext;
    }
    
    
    function autocopy_setClipboardContents(copytext)
    {	
    	try{
    		var str = Components.classes["@mozilla.org/supports-string;1"].
                createInstance(Components.interfaces.nsISupportsString);
    		if (!str) return false;
    		str.data = copytext;
    
    
    		var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    		if (!trans) return false;
    
    
    
    
    		trans.addDataFlavor("text/unicode");
    		trans.setTransferData("text/unicode",str,copytext.length * 2);
    
    
    		var clipid = Components.interfaces.nsIClipboard;
    		var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
    		if (!clip) return false;
    
    
    		clip.setData(trans,null,clipid.kGlobalClipboard);
    		return true;
    	}
    	catch(e)
    	{
    		return false;
    	}
    }
    
    
    function autocopy_setClipboardContentsHtml(copyhtml, copytext)
    {	
    	try{
    		var strhtml = Components.classes["@mozilla.org/supports-string;1"].
                createInstance(Components.interfaces.nsISupportsString);
    		if (!strhtml) return false;
    		strhtml.data = copyhtml;
    
    
    		var str = Components.classes["@mozilla.org/supports-string;1"].
                createInstance(Components.interfaces.nsISupportsString);
    		if (!str) return false;
    		str.data = copytext;
    
    
    		var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    		if (!trans) return false;
    
    
    		trans.addDataFlavor("text/html");
    		trans.setTransferData("text/html",strhtml,copyhtml.length * 2);
    
    
    		trans.addDataFlavor("text/unicode");
    		trans.setTransferData("text/unicode",str,copytext.length * 2);
    
    
    
    
    		var clipid = Components.interfaces.nsIClipboard;
    		var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
    		if (!clip) return false;
    
    
    		clip.setData(trans,null,clipid.kGlobalClipboard);
    
    
    		autocopy_saveclipboard()
    
    
    		return true;
    	}
    	catch(e)
    	{
    		return false;
    	}
    }
    
    
    
    
    function autocopy_saveclipboard()
    {
    	var clip = Components.classes["@mozilla.org/widget/clipboard;1"].
                 getService(Components.interfaces.nsIClipboard);
    	if (!clip) return false;
    
    
    	var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    	if (!trans) return false;
    
    
    	var importflavors = trans.flavorsTransferableCanImport();	
    	var exportflavors = trans.flavorsTransferableCanExport();	
    
    
    	trans.addDataFlavor("text/unicode");
    
    
    	clip.getData(trans,clip.kGlobalClipboard);
    
    
    	var dataType = new Object();
    	var data = new Object();
    	var dataLength = new Object();
    
    
    	try{
    		trans.getAnyTransferData(dataType, data, dataLength);
    	}
    	catch(e){	
    		return false;
    	}
    
    
    	var autocopy_clipboardcontents = new AutocopyClipboardContents(dataType, data, dataLength);
    	gautocopy_clipboardcontents.unshift(autocopy_clipboardcontents); //adds to the begining of array
    	if(gautocopy_clipboardcontents.length > 10 + 1)  
    	{
    		gautocopy_clipboardcontents.pop();  //remove last one if length to long
    	}
    
    
    	return true;
    
    
    }
    
    
    function autocopy_replaceoldclipboard(aIndex)
    {
    	try
    	{
    		if(gautocopy_clipboardcontents[aIndex])
    		{
    
    
    			if(autocopy_saveclipboard())
    			{
    				aIndex = aIndex + 1;
    
    
    				var trans = Components.classes["@mozilla.org/widget/transferable;1"].
        			          createInstance(Components.interfaces.nsITransferable);
    				if (!trans) return false;
    
    
    				trans.addDataFlavor(gautocopy_clipboardcontents[aIndex].dataType);
    				trans.setTransferData(gautocopy_clipboardcontents[aIndex].dataType.value, gautocopy_clipboardcontents[aIndex].data.value, gautocopy_clipboardcontents[aIndex].dataLength.value);
    
    
    				var clipid = Components.interfaces.nsIClipboard;
    				var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
    				if (!clip) return false;
    
    
    				clip.setData(trans,null,clipid.kGlobalClipboard);
    
    				if(aIndex > 1)
    				{
    					//move selected clipboardcontents to the begining of the clipboard array
    					var autocopy_clipboardcontents = gautocopy_clipboardcontents[aIndex];
    					gautocopy_clipboardcontents.splice(aIndex,1);
    				}
    				return true;
    			}
    			else
    			{	
    				return false;
    			}
    		}
    	}
    	catch(e)
    	{
    		return false;
    	}
    }
    
    
    function autocopy_pastetolocationbar()
    {
    	var str = autocopy_getClipboardContents();
    	if(str)
    	{
    		var urlbar = document.getElementById('urlbar');
    		urlbar.value = str;
    		urlbar.focus();
    	}
    }
    
    
    function autocopy_pastetosearchbar()
    {
    	var str = autocopy_getClipboardContents();
    	if(str)
    	{
    		var searchbar = document.getElementById('searchbar');
    		if(searchbar)
    		{
    			if(searchbar.textbox.value)
    			{
    				searchbar.textbox.focus();
    				searchbar.textbox.value = str;
    			}
    			if(searchbar.mTextbox.value)
    			{
    				searchbar.mTextbox.value = str;
    				searchbar.mTextbox.focus();
    			}
    		}
    	}
    
    
    }
    
    
    function autocopy_togglepasteonmiddleclick()
    {
    	PasteOnMiddleClickStatusbarOption =  document.getElementById('autocopy-statusbar-PasteOnMiddleClick');
    	if(PasteOnMiddleClickStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			autocopyPrefs.setBoolPref("optPasteOnMiddleClick", false);
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optPasteOnMiddleClick", true);
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleEnableInTextBoxes()
    {
    	EnableInTextBoxesStatusbarOption =  document.getElementById('autocopy-statusbar-EnableInTextBoxes');
    	if(EnableInTextBoxesStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    		{
    			autocopyPrefs.setBoolPref("optEnableInTextBoxes", false);
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optEnableInTextBoxes", true);
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleAutocopyContextMenu()
    {
    	AutocopyContextMenuStatusbarOption =  document.getElementById('autocopy-statusbar-AutocopyContextMenu');
    	if(AutocopyContextMenuStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optContextMenu"))
    		{
    			autocopyPrefs.setBoolPref("optContextMenu", false);
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optContextMenu", true);
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleStatusbarBlink()
    {
    	StatusbarBlinkStatusbarOption =  document.getElementById('autocopy-statusbar-StatusbarBlink');
    	if(StatusbarBlinkStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optStatusbarBlink"))
    		{
    			autocopyPrefs.setBoolPref("optStatusbarBlink", false);
    			StatusbarBlinkStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optStatusbarBlink", true);
    			StatusbarBlinkStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleDeselectAfterCopy()
    {
    	StatusbarDeselectAfterCopy =  document.getElementById('autocopy-statusbar-DeselectAfterCopy');
    	if(StatusbarDeselectAfterCopy)
    	{
    		if (autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", false);
    			StatusbarDeselectAfterCopy.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", true);
    			StatusbarDeselectAfterCopy.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_appendurltoclipboard() 
    {	
    	var clipboardcontents = autocopy_getClipboardContents();
    	if(clipboardcontents)
    	{
    		var copytext = clipboardcontents + "\r\n\r\n" + window.content.location.href;
    
    
    		var copyhtml = clipboardcontents + "\r\n <br><br>(From: <a href=\"" + window.content.location.href + "\">" + window.content.location.href + ")</a>";
    
    
    		autocopy_setClipboardContents(copytext);
    	}
    }
    
    
    function autocopy_timedhidemenu()
    {
    	window.clearTimeout(gautocopy_hidemenu_timer);
    	var timerinterval = autocopyPrefs.getIntPref("optContextMenuHideTimeout");
    	if(timerinterval > 0)
    	{
    		//if timer interval option is less then or equal to zero then don't timer hide the menu
    		gautocopy_hidemenu_timer = setTimeout("autocopy_hide_contextMenu();", timerinterval, 0); 
    	}
    }
    
    
    function autocopy_canceltimedhidemenu()
    {
    	window.clearTimeout(gautocopy_hidemenu_timer);
    }
    function autocopy_hide_contextMenu()
    {
    	document.getElementById('autocopy-context-menupopup-clipboards').hidePopup();
    	document.getElementById('autocopy-context-menu').hidePopup();
    }
    
    
    function autocopy_contextmenu_onpopupshowing(e)
    {
        	var strings = document.getElementById("autocopyStrings");
    	var localizedstringSearchFor = strings.getString("autocopy-context-menu-searchfor");
    	var searchformenuitem = document.getElementById('autocopy-context-menu-searchforselection');
    	if(searchformenuitem)
    	{
    		var SelectionText = autocopy_getSelection();
    		if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    		{
    			SelectionText = gautocopy_lastSelection;
    		}
    		if(SelectionText)
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' "' + SelectionText.substring(0,12) + '..."');
    		}
    		else
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' ');
    		}
    	}	
    
    
    } 
    
    
    function autocopy_context_onpopupshowing(e)
    {
        	var strings = document.getElementById("autocopyStrings");
    	var localizedstringSearchFor = strings.getString("autocopy-context-menu-searchfor");
    	var searchformenuitem = document.getElementById('autocopy-context-searchforselection');
    	if(searchformenuitem)
    	{
    		var SelectionText = autocopy_getSelection();
    		if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    		{
    			SelectionText = gautocopy_lastSelection;
    		}
    		if(SelectionText)
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' "' + SelectionText.substring(0,12) + '..."');
    		}
    		else
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' ');
    		}
    	}	
    
    
    } 
    
    
    
    
    function autocopy_context_menupopup_clipboards_onpopupshowing()
    {
    	var clipboardsmenupopup = document.getElementById('autocopy-context-menupopup-clipboards');
    
    
    	//remove all menuitems
    	while(clipboardsmenupopup.childNodes.length > 0)
    	{
    		clipboardsmenupopup.removeChild(clipboardsmenupopup.childNodes[0]);
    	}
    
    
    	if(gautocopy_clipboardcontents.length > 0)
    	{
    		for(var x = 0; x < gautocopy_clipboardcontents.length & x < 10; x++)
    		{
    			var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
    			if (!trans) return false;
    
    			trans.addDataFlavor(gautocopy_clipboardcontents[x].dataType.value);
    			trans.setTransferData(gautocopy_clipboardcontents[x].dataType.value, gautocopy_clipboardcontents[x].data.value, gautocopy_clipboardcontents[x].dataLength.value);
    
    
    			var str = new Object();
    			var strLength = new Object();
    
    
    			try{
    				trans.getTransferData(gautocopy_clipboardcontents[x].dataType.value,str,strLength);
    			}
    			catch(e){	
    				return false;
    			}
    			if(gautocopy_clipboardcontents[x].dataType.value == "text/unicode")
    			{
    				if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
    				if (str) pastetext = str.data.substring(0,strLength.value / 2);
    
    
    				var item = document.createElement('menuitem');
    				item.setAttribute('oncommand', "autocopy_replaceoldclipboard(" + x + ");");
    				item.setAttribute('label', pastetext.substring(0,24));
    				clipboardsmenupopup.appendChild(item);
    			}
    		}
    	}
    } 
    
    
    
    
    function autocopy_context_menupopup_clipboards2_onpopupshowing()
    {
    	var clipboardsmenupopup = document.getElementById('autocopy-context-menupopup-clipboards2');
    
    
    	//remove all menuitems
    	while(clipboardsmenupopup.childNodes.length > 0)
    	{
    		clipboardsmenupopup.removeChild(clipboardsmenupopup.childNodes[0]);
    	}
    
    
    	if(gautocopy_clipboardcontents.length > 0)
    	{
    		for(var x = 0; x < gautocopy_clipboardcontents.length & x < 10; x++)
    		{
    			var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
    			if (!trans) return false;
    
    			trans.addDataFlavor(gautocopy_clipboardcontents[x].dataType.value);
    			trans.setTransferData(gautocopy_clipboardcontents[x].dataType.value, gautocopy_clipboardcontents[x].data.value, gautocopy_clipboardcontents[x].dataLength.value);
    
    
    			var str = new Object();
    			var strLength = new Object();
    
    
    			try{
    				trans.getTransferData(gautocopy_clipboardcontents[x].dataType.value,str,strLength);
    			}
    			catch(e){	
    				return false;
    			}
    			if(gautocopy_clipboardcontents[x].dataType.value == "text/unicode")
    			{
    				if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
    				if (str) pastetext = str.data.substring(0,strLength.value / 2);
    
    
    				var item = document.createElement('menuitem');
    				item.setAttribute('oncommand', "autocopy_replaceoldclipboard(" + x + ");");
    				item.setAttribute('label', pastetext.substring(0,24));
    				clipboardsmenupopup.appendChild(item);
    			}
    		}
    	}
    } 
    
    
    
    
    
    
    function autocopy_searchforselection()
    {
    	var SelectionText = autocopy_getSelection();
    	if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    	{
    		SelectionText = gautocopy_lastSelection;
    	}
    	if(BrowserSearch)
    	{
    		BrowserSearch.loadSearch(SelectionText, true)
    	}
    	else
    	{
    		OpenSearch('internet', SelectionText, true);
    	}
    }
    
    
    function autocopy_openinnewtab()
    {
    	var SelectionText = autocopy_getSelection();
    	if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    	{
    		SelectionText = gautocopy_lastSelection;
    	}
    	window.gBrowser.addTab(SelectionText);
    }
    Alles anzeigen
  • userChrome.js Scripte für Fuchs 16 (Zusammenstellung) alt

    • loshombre
    • 29. Mai 2011 um 22:13

    Ja, schon klar. Es geht nur darum, dass der hier kopierte Javascript bei anderen auf einmal nicht funktionieren wollte, weil die Forumsoftware irgendwie das Format durcheinander brachte.
    Aber wir können es mal gerne versuchen:

    1. Auto Copy (Javascript):

    Code
    /* Auto Copy */
    
    
    var gautocopy_lastSelection = null;
    var gautocopy_hidemenu_timer = null;
    var gautocopy_clipboardcontents = new Array();
    var gautocopy_doPaste = false;
    
    
    window.addEventListener("load",function() {initAutoCopyStatus();} ,false);
    window.addEventListener("focus",function() {resetAutoCopyStatus();} ,false);
    
    
    window.addEventListener("mouseup", autocopyOnMouseUp ,false);
    window.addEventListener("keyup", autocopy_onKeyUpCheck ,false);
    
    
    //window.onmouseup = autocopyOnMouseUp;
    //window.onkeyup = autocopy_onKeyUpCheck;
    
    
    window.addEventListener("mousedown", Autocopy_Pasteonmiddleclick_mousedown ,false);
    window.addEventListener("mouseup", Autocopy_Pasteonmiddleclick_mouseup ,false);
    
    
    
    
    // prefs
    var autocopyPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("autocopy.");
    
    
    if (!autocopyPrefs.prefHasUserValue("StatusBarState"))
    	autocopyPrefs.setIntPref("StatusBarState", 1)
    
    
    
    
    
    
    
    
    function AutocopyClipboardContents(adataType, adata, adataLength)
    {
    	this.dataType = adataType;
    	this.data = adata;
    	this.dataLength = adataLength;
    }
    
    
    
    
    function autocopyContextHide(e) {
    
    
    	var cm = gContextMenu;
    	var AutocopyFirebirdcontextmenuitem = document.getElementById('autocopy-firebirdcontextmenuitem');
    
    
    	if(autocopyPrefs.getBoolPref("optContextMenuItem")){
    		AutocopyFirebirdcontextmenuitem.hidden = ( cm.onImage );
    		//|| cm.onLink || cm.onImage || cm.onTextInput );
    	}
    	else{
    	    AutocopyFirebirdcontextmenuitem.hidden = true;
    	}
    
    
    	if(AutocopyFirebirdcontextmenuitem.hidden)
    	{
    		document.getElementById('autocopy-firebirdcontextmenuitemseparator').hidden = true;
    	}
    	else
    	{
    		document.getElementById('autocopy-firebirdcontextmenuitemseparator').hidden = false;
    		autocopy_context_onpopupshowing(e);
    	}
    }
    
    
    
    
    function setAutoCopyStatus()
    {
    	if(autocopyPrefs.getBoolPref("optStatusBar")){
    		var autocopy = document.getElementById('autocopy-status');
    		var autocopystatusimage = document.getElementById('autocopy-status-image');
    		var tooltip = document.getElementById('autocopy-tooltip-value');
    
    
    		if(autocopy && autocopystatusimage)
    		{
    			autocopystatusimage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    		    	var strings = document.getElementById("autocopyStrings");
    			tooltip.setAttribute("value", strings.getString("statusbar-tooltip-enabled"));
    		}
    	}
    
    
    }
    
    
    
    
    
    
    function initAutoCopyStatus() 
    {
    	initPreferences();
    
    	document.getElementById("cmd_selectAll").setAttribute("oncommand", "goDoCommand('cmd_selectAll'); AutocopySelectAll();");
    
    
        	var strings = document.getElementById("autocopyStrings");
    
    
    	var autocopyLocalizationPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.{0FED7D55-65D4-47b6-A6DE-9A4ADB55355F}.");
    	var autocopylocaledescription = strings.getString("autocopy-description");
    	var str = Components.classes[ "@mozilla.org/supports-string;1" ].createInstance( Components.interfaces.nsISupportsString );
    	str.data = autocopylocaledescription;
    	autocopyLocalizationPrefs.setComplexValue( "description", Components.interfaces.nsISupportsString, str );
    
    
    
    	var autocopyStatusBarButtonPanel = document.getElementById('autocopy-statuspanel');
    	var autocopyStatusBarButton = document.getElementById('autocopy-status');
    	var autocopyStatusBarButtonImage = document.getElementById('autocopy-status-image');
    	var autocopyStatusBarButtonTooltip = document.getElementById('autocopy-tooltip-value');
    	if(autocopyStatusBarButton && autocopyStatusBarButtonImage)
    	{
    
    
    		if(autocopyPrefs.getBoolPref("optStatusBar")){
            	    if(autocopyStatusBarButtonPanel.collapsed)
    		    {
            	    	   autocopyStatusBarButtonPanel.collapsed = false;
    		    }
            	}
            	else{
            	    if(!autocopyStatusBarButtonPanel.collapsed)
    		    {
            	    	   autocopyStatusBarButtonPanel.collapsed = true;
    		    }
            	}
    
    
    
    		if (autocopyPrefs.getIntPref("StatusBarState") == 0)
    	        {
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    		                 autocopyStatusBarButton.setAttribute("status", "disabled");
    					autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyDisabled.png");
    	        	         autocopyStatusBarButtonTooltip.setAttribute("value", strings.getString("statusbar-tooltip-disabled"));
    	        	 }
    		}
    		else
    		{
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    	                 	autocopyStatusBarButton.setAttribute("status", "enabled");
    				autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    	                 	autocopyStatusBarButtonTooltip.setAttribute("value", strings.getString("statusbar-tooltip-enabled"));
    			 }
    		}
    
    
    	}
    
    
    
    
    
    
    
    
    	var AutocopyFirebirdmenuitem = document.getElementById('autocopy-firebirdmenuitem');
    	var AutocopyFirebirdmenuitemseparator = document.getElementById('autocopy-firebirdmenuitemseparator');
    	if(AutocopyFirebirdmenuitem)
    	{
    		if (autocopyPrefs.getIntPref("StatusBarState") == 0)
    	        {
    	                 AutocopyFirebirdmenuitem.setAttribute("checked", false);
    		}
    		else
    		{
    	                 AutocopyFirebirdmenuitem.setAttribute("checked", true);
    		}
    
    
    	        if(autocopyPrefs.getBoolPref("optEditMenuItem")){
    		    AutocopyFirebirdmenuitemseparator.setAttribute("hidden", false);
    	            AutocopyFirebirdmenuitem.setAttribute("hidden", false);
    	        }
    	        else{
    		    AutocopyFirebirdmenuitemseparator.setAttribute("hidden", true);
    	            AutocopyFirebirdmenuitem.setAttribute("hidden", true);
    	        }
    	}
    
    
    	var AutocopyFirebirdcontextmenuitem = document.getElementById('autocopy-firebirdcontextmenuitem');
    	if(AutocopyFirebirdcontextmenuitem)
    	{
    
    		if(document.getElementById("contentAreaContextMenu"))
    		{
    			document.getElementById("contentAreaContextMenu").addEventListener("popupshowing",autocopyContextHide,false);
    	        }	
    	}
    
    
    
    
    	var Autocopykeytoggleautocopyenabled = null;
    	if(document.getElementById('firebirdkey-toggle-autocopyenabled'))
    		Autocopykeytoggleautocopyenabled = document.getElementById('firebirdkey-toggle-autocopyenabled');
    	if(document.getElementById('mozillakey-toggle-autocopyenabled'))
    		Autocopykeytoggleautocopyenabled = document.getElementById('mozillakey-toggle-autocopyenabled');
    	if(document.getElementById('thunderbirdkey-toggle-autocopyenabled'))
    		Autocopykeytoggleautocopyenabled = document.getElementById('thunderbirdkey-toggle-autocopyenabled');
    
    
    	if(Autocopykeytoggleautocopyenabled)
    	{
    	        if(autocopyPrefs.getBoolPref("optKeyboardShortcutEnabled")){
    
    	            var optModifiers = "";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyAccel"))
    	                optModifiers = optModifiers + ",accel";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyMeta"))
    	                optModifiers = optModifiers + ",meta";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyCtrl"))
    	                optModifiers = optModifiers + ",control";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyShift"))
    	                optModifiers = optModifiers + ",shift";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyAlt"))
    	                optModifiers = optModifiers + ",alt";
    
    	            optModifiers.replace(/^\,/,"");
    
    	            var optKey = autocopyPrefs.getCharPref("optKeyboardShortcutKey");
    	            if(optKey.match(/^[A-Z]$/i)){
    	                Autocopykeytoggleautocopyenabled.setAttribute("key", optKey);
    	                Autocopykeytoggleautocopyenabled.setAttribute("keycode", "");
    	            }
    	            else{
    	                Autocopykeytoggleautocopyenabled.setAttribute("key", "");
    	                Autocopykeytoggleautocopyenabled.setAttribute("keycode", optKey);
    	            }
    
    	            Autocopykeytoggleautocopyenabled.setAttribute("modifiers", optModifiers);
    	            Autocopykeytoggleautocopyenabled.setAttribute("disabled", false);
    	        }
    	        else{
    	            Autocopykeytoggleautocopyenabled.setAttribute("disabled", true);
    	        }
    	}
    
    
    
    
    	PasteOnMiddleClickStatusbarOption =  document.getElementById('autocopy-statusbar-PasteOnMiddleClick');
    	if(PasteOnMiddleClickStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	EnableInTextBoxesStatusbarOption =  document.getElementById('autocopy-statusbar-EnableInTextBoxes');
    	if(EnableInTextBoxesStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    		{
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	AutocopyContextMenuStatusbarOption =  document.getElementById('autocopy-statusbar-AutocopyContextMenu');
    	if(AutocopyContextMenuStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optContextMenu"))
    		{
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	StatusbarBlinkStatusbarOption =  document.getElementById('autocopy-statusbar-StatusbarBlink');
    	if(StatusbarBlinkStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optStatusbarBlink"))
    		{
    			StatusbarBlinkStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			StatusbarBlinkStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	StatusbarDeselectAfterCopy =  document.getElementById('autocopy-statusbar-DeselectAfterCopy');
    	if(StatusbarDeselectAfterCopy)
    	{
    		if (autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    		{
    			StatusbarDeselectAfterCopy.setAttribute("checked", true);
    		}
    		else
    		{
    			StatusbarDeselectAfterCopy.setAttribute("checked", false);
    		}
    	}
    
    
    
    
    
    
    
    
    }
    
    
    /////////////////
    //
    //window.addEventListener("load",function() {AutoCopyCopyOnLoad();} ,true);
    //
    //function AutoCopyCopyOnLoad()
    //{
    //////////////////
    //goDoCommand('cmd_selectAll');
    //AutocopySelectAll();
    //Autocopy_DeselectAfterCopy_CollapseSelection()
    //}
    /////////////////
    
    
    function resetAutoCopyStatus()
    {
        initAutoCopyStatus()
    }
    
    
    
    
    function initPreferences(){
    
    
    	if (!autocopyPrefs.prefHasUserValue("StatusBarState"))
    		autocopyPrefs.setIntPref("StatusBarState", 1)
    
    
    	if (!autocopyPrefs.prefHasUserValue("optPasteOnMiddleClick"))
    		autocopyPrefs.setBoolPref("optPasteOnMiddleClick", true);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optDeselectAfterCopy"))
    	{
    		if(navigator.vendor.match(/Thunderbird/i))
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", false);
    		}
    	}
    
    
    
    
    	if (!autocopyPrefs.prefHasUserValue("optCopyWithoutFormating"))
    		autocopyPrefs.setBoolPref("optCopyWithoutFormating", false);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optStatusBar"))
    		autocopyPrefs.setBoolPref("optStatusBar", true);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optStatusbarBlink"))
    		autocopyPrefs.setBoolPref("optStatusbarBlink", true);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optContextMenu"))
    		autocopyPrefs.setBoolPref("optContextMenu", false);
    
    
    
    
    	if (!autocopyPrefs.prefHasUserValue("optContextMenuHideTimeout"))
    		autocopyPrefs.setIntPref("optContextMenuHideTimeout", 2000);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optEditMenuItem"))
    		autocopyPrefs.setBoolPref("optEditMenuItem", false);
    	if (!autocopyPrefs.prefHasUserValue("optContextMenuItem"))
    		autocopyPrefs.setBoolPref("optContextMenuItem", true);
    	if (!autocopyPrefs.prefHasUserValue("optEnableInTextBoxes"))
    		autocopyPrefs.setBoolPref("optEnableInTextBoxes", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutEnabled"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutEnabled", false);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyAccel"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyAccel", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyMeta"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyMeta", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyCtrl"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyCtrl", true);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyShift"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyShift", true);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyAlt"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyAlt", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKey"))
    		autocopyPrefs.setCharPref("optKeyboardShortcutKey", "C");
    }
    
    
    
    
    
    
    
    
    function switchautocopystatusstate()
    {
            if (autocopyPrefs.getIntPref("StatusBarState") == 0)
            {
    		autocopyPrefs.setIntPref("StatusBarState", 1);
            }
            else
            {
    		autocopyPrefs.setIntPref("StatusBarState", 0);
            }
            initAutoCopyStatus();
    }
    
    
    function autocopy_onKeyUpCheck(e)
    {
    	if(e.keyCode == e.DOM_VK_A && e.ctrlKey)
    	{
    		autocopyOnMouseUp(e);
    	}
    }
    
    
    
    
    function autocopyOnMouseUp(e)
    {
       if ((!e.ctrlKey) || (e.keyCode))
       {
    	var targetclassname = e.target.toString();
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    		if(!targetclassname.match(/SelectElement|OptionElement/i))
    		{
    			if(!Autocopy_isTargetEditable(e.target))
    			{
    				if (!targetclassname.match(/object XUL/i))
    				{
    
    
    					if((autocopy_getSelection().length > 0) && (gautocopy_lastSelection != autocopy_getSelection()))
    					{
    						//were going to copy
    						gautocopy_lastSelection = autocopy_getSelection();
    						autocopy_saveclipboard();
    						if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    						{
    							copyplaintext();
    						}
    						else
    						{
    							goDoCommand('cmd_copy');
    						}
    						if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    						{
    							AutocopyBlinkStatusbarButton(3);
    						}
    						if (autocopyPrefs.getBoolPref("optContextMenu"))
    						{
    							var x = e.screenX;
    							var y = e.screenY;
    							if(x == 0 && y == 0)
    							{
    								document.popupNode = document.documentElement;
    								document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    								autocopy_timedhidemenu(); 
    							}
    							else
    							{
    								document.popupNode = null;
    								document.getElementById('autocopy-context-menu').showPopup(document.documentElement, x, y, "context");
    								autocopy_timedhidemenu(); 
    							}
    						}
    						if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    						{
    							Autocopy_DeselectAfterCopy();
    						}
    					}
    				}
    			}
    			else if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    			{
    				if((autocopy_getSelection().length > 0) && (gautocopy_lastSelection != autocopy_getSelection()))
    				{
    					//were going to copy
    					gautocopy_lastSelection = autocopy_getSelection();
    					autocopy_saveclipboard();
    					if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    					{
    						//copyplaintext dosn't work in textboxes
    						//copyplaintext();
    						goDoCommand('cmd_copy');
    					}
    					else
    					{
    						goDoCommand('cmd_copy');
    					}
    					if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    					{
    						AutocopyBlinkStatusbarButton(3);
    					}
    					if (autocopyPrefs.getBoolPref("optContextMenu"))
    					{
    						var x = e.screenX;
    						var y = e.screenY;
    						if(x == 0 && y == 0)
    						{
    							document.popupNode = document.documentElement;
    							document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    							autocopy_timedhidemenu(); 
    						}
    						else
    						{
    							document.popupNode = null;
    							document.getElementById('autocopy-context-menu').showPopup(document.documentElement, x, y, "context");
    							autocopy_timedhidemenu(); 
    						}
    					}
    					if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    					{
    						Autocopy_DeselectAfterCopy();
    					}
    				}
    			}
    		}
       	}
       }
    }
    
    
    
    
    function AutocopySelectAll()
    {
    	var targetclassname = "";
    	if(document.commandDispatcher.focusedElement)
    	{	
    		targetclassname = document.commandDispatcher.focusedElement.toString();
    	}
    
    
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    //		if (!targetclassname.match(/object XUL/i))
    //		{
    			if(!targetclassname.match(/SelectElement|OptionElement/i))
    			{
    				if(!Autocopy_isTargetEditableDispatcher(document.commandDispatcher))
    				{
    					if(autocopy_getSelection().length > 0)
    					{
    						//were going to copy
    						gautocopy_lastSelection = autocopy_getSelection();
    						autocopy_saveclipboard();
    						if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    						{
    							copyplaintext();
    						}
    						else
    						{
    							goDoCommand('cmd_copy');
    						}
    						if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    						{
    							AutocopyBlinkStatusbarButton(3);
    						}
    						if (autocopyPrefs.getBoolPref("optContextMenu"))
    						{
    							document.popupNode = document.documentElement;
    							document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    							autocopy_timedhidemenu(); 
    						}
    						if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    						{
    							Autocopy_DeselectAfterCopy();
    						}
    					}
    				}
    				else if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    				{
    					if((autocopy_getSelection().length > 0) && (gautocopy_lastSelection != autocopy_getSelection()))
    					{
    						gautocopy_lastSelection = autocopy_getSelection();
    						autocopy_saveclipboard();
    						if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    						{
    							//copyplaintext dosn't work in textboxes
    							//copyplaintext();
    							goDoCommand('cmd_copy');
    						}
    						else
    						{
    							goDoCommand('cmd_copy');
    						}
    						if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    						{
    							AutocopyBlinkStatusbarButton(3);
    						}
    						if (autocopyPrefs.getBoolPref("optContextMenu"))
    						{
    								document.popupNode = document.documentElement;
    								document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    								autocopy_timedhidemenu(); 
    						}
    						if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    						{
    							Autocopy_DeselectAfterCopy();
    						}
    					}
    				}
    			}
    //		}
    	}
    }
    
    
    
    
    function Autocopy_Pasteonmiddleclick_mousedown(e)
    {
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    		if((!e.ctrlKey) && autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			if(e.button == 1)
    			{
    				gautocopy_doPaste = false;	
    
    
    				if(e.target.inputField)
    				{
    					if(e.target.inputField.toString().match(/InputElement|TextAreaElement/i))
    					{
    						gautocopy_doPaste = true;
    					}
    				}	
    				if(e.target.mTextbox)
    				{
    					if(e.target.mTextbox.inputField)
    					{
    						if(e.target.mTextbox.inputField.toString().match(/InputElement|TextAreaElement/i))
    						{
    							gautocopy_doPaste = true;
    						}
    					}
    				}
    				if(Autocopy_isTargetEditable(e.target))
    				{
    					gautocopy_doPaste = true;
    				}
    
    				if(gautocopy_doPaste)
    				{
    					if (getBrowser().mCurrentBrowser.autoscrollEnabled) 
    					{
    						getBrowser().mCurrentBrowser._autoScrollPopup.hidePopup();
    						getBrowser().mCurrentBrowser.stopScroll();
    					}
    				}
    			}
    		}
    	}	
    }
    function Autocopy_Pasteonmiddleclick_mouseup(e)
    {
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    		if((!e.ctrlKey) && autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			if(e.button == 1)
    			{
    				if(gautocopy_doPaste)
    				{
    					goDoCommand('cmd_paste');
    					if (getBrowser().mCurrentBrowser.autoscrollEnabled) 
    					{
    						getBrowser().mCurrentBrowser._autoScrollPopup.hidePopup();
    						getBrowser().mCurrentBrowser.stopScroll();
    					}
    				}
    			}
    		}
    	}	
    }
    
    
    
    
    
    
    
    
    function Autocopy_isTargetEditable(target)
    {
    if(target)
    {
      if(target.toString().match(/InputElement|TextAreaElement/i))
      {
        return true;
      }
    
    
      if(target.textbox)
      {
        return true;
      }
    
    
      if(target.ownerDocument)
      {
        if(target.ownerDocument.designMode)
        {
          if(target.ownerDocument.designMode.match(/on/i))
          {
            return true;
          }
        }
      }
    }
    return false;
    }
    
    
    
    
    
    
    
    
    function Autocopy_isTargetEditableDispatcher(commandDispatcher)
    {
    
    
    	
    	if(commandDispatcher.focusedElement)
    	{
    		if(commandDispatcher.focusedElement.toString().match(/InputElement|TextAreaElement/i))
    		{
    			return true;
    		}
    	}
    	else
    	{
    		if(commandDispatcher.focusedWindow.document.designMode)
    		{
    			if(commandDispatcher.focusedWindow.document.designMode.match(/on/i))
    			{
    				return true;
    			}
    		}
    	}
    
    
    	return false;
    }
    
    
    function Autocopy_DeselectAfterCopy()
    {
    
    
    	if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    	{
    		var focusedElement = document.commandDispatcher.focusedElement;
    		if(focusedElement)
    		{
    			SelectionLength = focusedElement.selectionEnd - focusedElement.selectionStart;
    			Autocopy_DeselectAfterCopy_CollapseSelection_TextBox()
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection_TextBox, 25, SelectionLength); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection_TextBox, 50); 
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection_TextBox, 75, SelectionLength); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection_TextBox, 100); 	
    		}
    		else
    		{
    			var focusedWindow = document.commandDispatcher.focusedWindow;
    			try
    			{
    				var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    				var Selection = winWrapper.getSelection();
    			}
    			catch(e)
    			{
    				var Selection = focusedWindow.getSelection();
    			}
    			var SelectionfocusNode = Selection.focusNode;
    			var SelectionfocusOffset = Selection.focusOffset;
    			Autocopy_DeselectAfterCopy_CollapseSelection()
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection, 25, SelectionfocusNode, SelectionfocusOffset); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection, 50); 
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection, 75, SelectionfocusNode, SelectionfocusOffset); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection, 100); 	
    		}
    	}
    	else
    	{	
    		var focusedElement = document.commandDispatcher.focusedElement;
    		if(focusedElement)
    		{		
    			Autocopy_DeselectAfterCopy_CollapseSelection_TextBox()
    		}
    		else
    		{
    			goDoCommand('cmd_selectNone');
    		}
    	}
    }
    function Autocopy_DeselectAfterCopy_ExtendSelection_TextBox(SelectionLength)
    {
    	var focusedElement = document.commandDispatcher.focusedElement;
    	if(focusedElement)
    	{
    		focusedElement.selectionEnd = focusedElement.selectionStart + SelectionLength;
    	}
    }
    function Autocopy_DeselectAfterCopy_CollapseSelection_TextBox()
    {
    	var focusedElement = document.commandDispatcher.focusedElement;
    	if(focusedElement)
    	{
    		focusedElement.selectionEnd = focusedElement.selectionStart;
    	}
    }
    function Autocopy_DeselectAfterCopy_ExtendSelection(SelectionfocusNode, SelectionfocusOffset)
    {
    	var focusedWindow = document.commandDispatcher.focusedWindow;
    	try
    	{
    		var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    		var Selection = winWrapper.getSelection();
    	}
    	catch(e)
    	{
    		var Selection = focusedWindow.getSelection();
    	}
    	Selection.extend(SelectionfocusNode, SelectionfocusOffset);
    }
    function Autocopy_DeselectAfterCopy_CollapseSelection()
    {
    	var focusedWindow = document.commandDispatcher.focusedWindow;
    	try
    	{
    		var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    		var Selection = winWrapper.getSelection();
    	}
    	catch(e)
    	{
    		var Selection = focusedWindow.getSelection();
    	}
    	var SelectionanchorNode = Selection.anchorNode;
    	var SelectionanchorOffset = Selection.anchorOffset;
    	Selection.collapse(SelectionanchorNode, SelectionanchorOffset);
    }
    
    
    
    
    
    
    function AutocopyBlinkStatusbarButton(numberofblinks)
    {
    	setTimeout(AutocopyBlinkStatusbarButton, 5000, 0); //resets in 5 seconds just incase
    
    
    	var autocopyStatusBarButton = document.getElementById('autocopy-status');
    	var autocopyStatusBarButtonImage = document.getElementById('autocopy-status-image');
    	var autocopyStatusBarButtonTooltip = document.getElementById('autocopy-tooltip-value');
    	if (numberofblinks > 0)
    	{
    		if (autocopyPrefs.getIntPref("StatusBarState") != 0)
    		{
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    				if(autocopyStatusBarButtonImage.getAttribute("src") == "chrome://autocopy/skin/AutoCopyEnabled.png")
    				{
    					autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyBlank.png");
    				}
    				else
    				{
    					autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    				}
    				numberofblinks = numberofblinks - 1;
    		     		setTimeout(AutocopyBlinkStatusbarButton, 300, numberofblinks);
    			 }
    		}
    	}
    	else
    	{
    		if (autocopyPrefs.getIntPref("StatusBarState") != 0)
    		{
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    				autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    			 }
    		}
    	}
    }
    
    
    
    
    function autocopy_getSelection() 
    {
    	var SelectionText = "";
    	var trywindow = false;
    
    	var focusedElement = document.commandDispatcher.focusedElement;
    	if(focusedElement && null != focusedElement)
    	{
    		try
    		{
    			SelectionText = focusedElement.value.substring(focusedElement.selectionStart, focusedElement.selectionEnd);
    		}
    		catch(e)
    		{
    			trywindow = true;
    		}
    	}
    	else
    	{
    		trywindow = true;
    	}
    
    	if(trywindow)
    	{
    		var focusedWindow = document.commandDispatcher.focusedWindow;
    		try
    		{
    			var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    			var Selection = winWrapper.getSelection();
    		}
    		catch(e)
    		{
    			var Selection = focusedWindow.getSelection();
    		}
    		SelectionText = Selection.toString();
    
    
    	}
    	return SelectionText;
    }
    
    
    function autocopy_getClipboardContents()
    {
    	var clip = Components.classes["@mozilla.org/widget/clipboard;1"].
                 getService(Components.interfaces.nsIClipboard);
    	if (!clip) return false;
    
    
    	var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    	if (!trans) return false;
    		trans.addDataFlavor("text/unicode");
    
    
    	clip.getData(trans,clip.kGlobalClipboard);
    
    
    	var str = new Object();
    	var strLength = new Object();
    
    
    	try{
    		trans.getTransferData("text/unicode",str,strLength);
    	}
    	catch(e){	
    		return false;
    	}
    	if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
    	if (str) pastetext = str.data.substring(0,strLength.value / 2);
    
    	return pastetext;
    }
    
    
    function autocopy_setClipboardContents(copytext)
    {	
    	try{
    		var str = Components.classes["@mozilla.org/supports-string;1"].
                createInstance(Components.interfaces.nsISupportsString);
    		if (!str) return false;
    		str.data = copytext;
    
    
    		var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    		if (!trans) return false;
    
    
    
    
    		trans.addDataFlavor("text/unicode");
    		trans.setTransferData("text/unicode",str,copytext.length * 2);
    
    
    		var clipid = Components.interfaces.nsIClipboard;
    		var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
    		if (!clip) return false;
    
    
    		clip.setData(trans,null,clipid.kGlobalClipboard);
    		return true;
    	}
    	catch(e)
    	{
    		return false;
    	}
    }
    
    
    function autocopy_setClipboardContentsHtml(copyhtml, copytext)
    {	
    	try{
    		var strhtml = Components.classes["@mozilla.org/supports-string;1"].
                createInstance(Components.interfaces.nsISupportsString);
    		if (!strhtml) return false;
    		strhtml.data = copyhtml;
    
    
    		var str = Components.classes["@mozilla.org/supports-string;1"].
                createInstance(Components.interfaces.nsISupportsString);
    		if (!str) return false;
    		str.data = copytext;
    
    
    		var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    		if (!trans) return false;
    
    
    		trans.addDataFlavor("text/html");
    		trans.setTransferData("text/html",strhtml,copyhtml.length * 2);
    
    
    		trans.addDataFlavor("text/unicode");
    		trans.setTransferData("text/unicode",str,copytext.length * 2);
    
    
    
    
    		var clipid = Components.interfaces.nsIClipboard;
    		var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
    		if (!clip) return false;
    
    
    		clip.setData(trans,null,clipid.kGlobalClipboard);
    
    
    		autocopy_saveclipboard()
    
    
    		return true;
    	}
    	catch(e)
    	{
    		return false;
    	}
    }
    
    
    
    
    function autocopy_saveclipboard()
    {
    	var clip = Components.classes["@mozilla.org/widget/clipboard;1"].
                 getService(Components.interfaces.nsIClipboard);
    	if (!clip) return false;
    
    
    	var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    	if (!trans) return false;
    
    
    	var importflavors = trans.flavorsTransferableCanImport();	
    	var exportflavors = trans.flavorsTransferableCanExport();	
    
    
    	trans.addDataFlavor("text/unicode");
    
    
    	clip.getData(trans,clip.kGlobalClipboard);
    
    
    	var dataType = new Object();
    	var data = new Object();
    	var dataLength = new Object();
    
    
    	try{
    		trans.getAnyTransferData(dataType, data, dataLength);
    	}
    	catch(e){	
    		return false;
    	}
    
    
    	var autocopy_clipboardcontents = new AutocopyClipboardContents(dataType, data, dataLength);
    	gautocopy_clipboardcontents.unshift(autocopy_clipboardcontents); //adds to the begining of array
    	if(gautocopy_clipboardcontents.length > 10 + 1)  
    	{
    		gautocopy_clipboardcontents.pop();  //remove last one if length to long
    	}
    
    
    	return true;
    
    
    }
    
    
    function autocopy_replaceoldclipboard(aIndex)
    {
    	try
    	{
    		if(gautocopy_clipboardcontents[aIndex])
    		{
    
    
    			if(autocopy_saveclipboard())
    			{
    				aIndex = aIndex + 1;
    
    
    				var trans = Components.classes["@mozilla.org/widget/transferable;1"].
        			          createInstance(Components.interfaces.nsITransferable);
    				if (!trans) return false;
    
    
    				trans.addDataFlavor(gautocopy_clipboardcontents[aIndex].dataType);
    				trans.setTransferData(gautocopy_clipboardcontents[aIndex].dataType.value, gautocopy_clipboardcontents[aIndex].data.value, gautocopy_clipboardcontents[aIndex].dataLength.value);
    
    
    				var clipid = Components.interfaces.nsIClipboard;
    				var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
    				if (!clip) return false;
    
    
    				clip.setData(trans,null,clipid.kGlobalClipboard);
    
    				if(aIndex > 1)
    				{
    					//move selected clipboardcontents to the begining of the clipboard array
    					var autocopy_clipboardcontents = gautocopy_clipboardcontents[aIndex];
    					gautocopy_clipboardcontents.splice(aIndex,1);
    				}
    				return true;
    			}
    			else
    			{	
    				return false;
    			}
    		}
    	}
    	catch(e)
    	{
    		return false;
    	}
    }
    
    
    function autocopy_pastetolocationbar()
    {
    	var str = autocopy_getClipboardContents();
    	if(str)
    	{
    		var urlbar = document.getElementById('urlbar');
    		urlbar.value = str;
    		urlbar.focus();
    	}
    }
    
    
    function autocopy_pastetosearchbar()
    {
    	var str = autocopy_getClipboardContents();
    	if(str)
    	{
    		var searchbar = document.getElementById('searchbar');
    		if(searchbar)
    		{
    			if(searchbar.textbox.value)
    			{
    				searchbar.textbox.focus();
    				searchbar.textbox.value = str;
    			}
    			if(searchbar.mTextbox.value)
    			{
    				searchbar.mTextbox.value = str;
    				searchbar.mTextbox.focus();
    			}
    		}
    	}
    
    
    }
    
    
    function autocopy_togglepasteonmiddleclick()
    {
    	PasteOnMiddleClickStatusbarOption =  document.getElementById('autocopy-statusbar-PasteOnMiddleClick');
    	if(PasteOnMiddleClickStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			autocopyPrefs.setBoolPref("optPasteOnMiddleClick", false);
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optPasteOnMiddleClick", true);
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleEnableInTextBoxes()
    {
    	EnableInTextBoxesStatusbarOption =  document.getElementById('autocopy-statusbar-EnableInTextBoxes');
    	if(EnableInTextBoxesStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    		{
    			autocopyPrefs.setBoolPref("optEnableInTextBoxes", false);
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optEnableInTextBoxes", true);
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleAutocopyContextMenu()
    {
    	AutocopyContextMenuStatusbarOption =  document.getElementById('autocopy-statusbar-AutocopyContextMenu');
    	if(AutocopyContextMenuStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optContextMenu"))
    		{
    			autocopyPrefs.setBoolPref("optContextMenu", false);
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optContextMenu", true);
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleStatusbarBlink()
    {
    	StatusbarBlinkStatusbarOption =  document.getElementById('autocopy-statusbar-StatusbarBlink');
    	if(StatusbarBlinkStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optStatusbarBlink"))
    		{
    			autocopyPrefs.setBoolPref("optStatusbarBlink", false);
    			StatusbarBlinkStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optStatusbarBlink", true);
    			StatusbarBlinkStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleDeselectAfterCopy()
    {
    	StatusbarDeselectAfterCopy =  document.getElementById('autocopy-statusbar-DeselectAfterCopy');
    	if(StatusbarDeselectAfterCopy)
    	{
    		if (autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", false);
    			StatusbarDeselectAfterCopy.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", true);
    			StatusbarDeselectAfterCopy.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_appendurltoclipboard() 
    {	
    	var clipboardcontents = autocopy_getClipboardContents();
    	if(clipboardcontents)
    	{
    		var copytext = clipboardcontents + "\r\n\r\n" + window.content.location.href;
    
    
    		var copyhtml = clipboardcontents + "\r\n <br><br>(From: <a href=\"" + window.content.location.href + "\">" + window.content.location.href + ")</a>";
    
    
    		autocopy_setClipboardContents(copytext);
    	}
    }
    
    
    function autocopy_timedhidemenu()
    {
    	window.clearTimeout(gautocopy_hidemenu_timer);
    	var timerinterval = autocopyPrefs.getIntPref("optContextMenuHideTimeout");
    	if(timerinterval > 0)
    	{
    		//if timer interval option is less then or equal to zero then don't timer hide the menu
    		gautocopy_hidemenu_timer = setTimeout("autocopy_hide_contextMenu();", timerinterval, 0); 
    	}
    }
    
    
    function autocopy_canceltimedhidemenu()
    {
    	window.clearTimeout(gautocopy_hidemenu_timer);
    }
    function autocopy_hide_contextMenu()
    {
    	document.getElementById('autocopy-context-menupopup-clipboards').hidePopup();
    	document.getElementById('autocopy-context-menu').hidePopup();
    }
    
    
    function autocopy_contextmenu_onpopupshowing(e)
    {
        	var strings = document.getElementById("autocopyStrings");
    	var localizedstringSearchFor = strings.getString("autocopy-context-menu-searchfor");
    	var searchformenuitem = document.getElementById('autocopy-context-menu-searchforselection');
    	if(searchformenuitem)
    	{
    		var SelectionText = autocopy_getSelection();
    		if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    		{
    			SelectionText = gautocopy_lastSelection;
    		}
    		if(SelectionText)
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' "' + SelectionText.substring(0,12) + '..."');
    		}
    		else
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' ');
    		}
    	}	
    
    
    } 
    
    
    function autocopy_context_onpopupshowing(e)
    {
        	var strings = document.getElementById("autocopyStrings");
    	var localizedstringSearchFor = strings.getString("autocopy-context-menu-searchfor");
    	var searchformenuitem = document.getElementById('autocopy-context-searchforselection');
    	if(searchformenuitem)
    	{
    		var SelectionText = autocopy_getSelection();
    		if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    		{
    			SelectionText = gautocopy_lastSelection;
    		}
    		if(SelectionText)
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' "' + SelectionText.substring(0,12) + '..."');
    		}
    		else
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' ');
    		}
    	}	
    
    
    } 
    
    
    
    
    function autocopy_context_menupopup_clipboards_onpopupshowing()
    {
    	var clipboardsmenupopup = document.getElementById('autocopy-context-menupopup-clipboards');
    
    
    	//remove all menuitems
    	while(clipboardsmenupopup.childNodes.length > 0)
    	{
    		clipboardsmenupopup.removeChild(clipboardsmenupopup.childNodes[0]);
    	}
    
    
    	if(gautocopy_clipboardcontents.length > 0)
    	{
    		for(var x = 0; x < gautocopy_clipboardcontents.length & x < 10; x++)
    		{
    			var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
    			if (!trans) return false;
    
    			trans.addDataFlavor(gautocopy_clipboardcontents[x].dataType.value);
    			trans.setTransferData(gautocopy_clipboardcontents[x].dataType.value, gautocopy_clipboardcontents[x].data.value, gautocopy_clipboardcontents[x].dataLength.value);
    
    
    			var str = new Object();
    			var strLength = new Object();
    
    
    			try{
    				trans.getTransferData(gautocopy_clipboardcontents[x].dataType.value,str,strLength);
    			}
    			catch(e){	
    				return false;
    			}
    			if(gautocopy_clipboardcontents[x].dataType.value == "text/unicode")
    			{
    				if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
    				if (str) pastetext = str.data.substring(0,strLength.value / 2);
    
    
    				var item = document.createElement('menuitem');
    				item.setAttribute('oncommand', "autocopy_replaceoldclipboard(" + x + ");");
    				item.setAttribute('label', pastetext.substring(0,24));
    				clipboardsmenupopup.appendChild(item);
    			}
    		}
    	}
    } 
    
    
    
    
    function autocopy_context_menupopup_clipboards2_onpopupshowing()
    {
    	var clipboardsmenupopup = document.getElementById('autocopy-context-menupopup-clipboards2');
    
    
    	//remove all menuitems
    	while(clipboardsmenupopup.childNodes.length > 0)
    	{
    		clipboardsmenupopup.removeChild(clipboardsmenupopup.childNodes[0]);
    	}
    
    
    	if(gautocopy_clipboardcontents.length > 0)
    	{
    		for(var x = 0; x < gautocopy_clipboardcontents.length & x < 10; x++)
    		{
    			var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
    			if (!trans) return false;
    
    			trans.addDataFlavor(gautocopy_clipboardcontents[x].dataType.value);
    			trans.setTransferData(gautocopy_clipboardcontents[x].dataType.value, gautocopy_clipboardcontents[x].data.value, gautocopy_clipboardcontents[x].dataLength.value);
    
    
    			var str = new Object();
    			var strLength = new Object();
    
    
    			try{
    				trans.getTransferData(gautocopy_clipboardcontents[x].dataType.value,str,strLength);
    			}
    			catch(e){	
    				return false;
    			}
    			if(gautocopy_clipboardcontents[x].dataType.value == "text/unicode")
    			{
    				if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
    				if (str) pastetext = str.data.substring(0,strLength.value / 2);
    
    
    				var item = document.createElement('menuitem');
    				item.setAttribute('oncommand', "autocopy_replaceoldclipboard(" + x + ");");
    				item.setAttribute('label', pastetext.substring(0,24));
    				clipboardsmenupopup.appendChild(item);
    			}
    		}
    	}
    } 
    
    
    
    
    
    
    function autocopy_searchforselection()
    {
    	var SelectionText = autocopy_getSelection();
    	if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    	{
    		SelectionText = gautocopy_lastSelection;
    	}
    	if(BrowserSearch)
    	{
    		BrowserSearch.loadSearch(SelectionText, true)
    	}
    	else
    	{
    		OpenSearch('internet', SelectionText, true);
    	}
    }
    
    
    function autocopy_openinnewtab()
    {
    	var SelectionText = autocopy_getSelection();
    	if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    	{
    		SelectionText = gautocopy_lastSelection;
    	}
    	window.gBrowser.addTab(SelectionText);
    }
    Alles anzeigen
  • userChrome.js Scripte für Fuchs 14 (Zusammenstellung)

    • loshombre
    • 29. Mai 2011 um 22:13

    Ja, schon klar. Es geht nur darum, dass der hier kopierte Javascript bei anderen auf einmal nicht funktionieren wollte, weil die Forumsoftware irgendwie das Format durcheinander brachte.
    Aber wir können es mal gerne versuchen:

    1. Auto Copy (Javascript):

    Code
    /* Auto Copy */
    
    
    var gautocopy_lastSelection = null;
    var gautocopy_hidemenu_timer = null;
    var gautocopy_clipboardcontents = new Array();
    var gautocopy_doPaste = false;
    
    
    window.addEventListener("load",function() {initAutoCopyStatus();} ,false);
    window.addEventListener("focus",function() {resetAutoCopyStatus();} ,false);
    
    
    window.addEventListener("mouseup", autocopyOnMouseUp ,false);
    window.addEventListener("keyup", autocopy_onKeyUpCheck ,false);
    
    
    //window.onmouseup = autocopyOnMouseUp;
    //window.onkeyup = autocopy_onKeyUpCheck;
    
    
    window.addEventListener("mousedown", Autocopy_Pasteonmiddleclick_mousedown ,false);
    window.addEventListener("mouseup", Autocopy_Pasteonmiddleclick_mouseup ,false);
    
    
    
    
    // prefs
    var autocopyPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("autocopy.");
    
    
    if (!autocopyPrefs.prefHasUserValue("StatusBarState"))
    	autocopyPrefs.setIntPref("StatusBarState", 1)
    
    
    
    
    
    
    
    
    function AutocopyClipboardContents(adataType, adata, adataLength)
    {
    	this.dataType = adataType;
    	this.data = adata;
    	this.dataLength = adataLength;
    }
    
    
    
    
    function autocopyContextHide(e) {
    
    
    	var cm = gContextMenu;
    	var AutocopyFirebirdcontextmenuitem = document.getElementById('autocopy-firebirdcontextmenuitem');
    
    
    	if(autocopyPrefs.getBoolPref("optContextMenuItem")){
    		AutocopyFirebirdcontextmenuitem.hidden = ( cm.onImage );
    		//|| cm.onLink || cm.onImage || cm.onTextInput );
    	}
    	else{
    	    AutocopyFirebirdcontextmenuitem.hidden = true;
    	}
    
    
    	if(AutocopyFirebirdcontextmenuitem.hidden)
    	{
    		document.getElementById('autocopy-firebirdcontextmenuitemseparator').hidden = true;
    	}
    	else
    	{
    		document.getElementById('autocopy-firebirdcontextmenuitemseparator').hidden = false;
    		autocopy_context_onpopupshowing(e);
    	}
    }
    
    
    
    
    function setAutoCopyStatus()
    {
    	if(autocopyPrefs.getBoolPref("optStatusBar")){
    		var autocopy = document.getElementById('autocopy-status');
    		var autocopystatusimage = document.getElementById('autocopy-status-image');
    		var tooltip = document.getElementById('autocopy-tooltip-value');
    
    
    		if(autocopy && autocopystatusimage)
    		{
    			autocopystatusimage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    		    	var strings = document.getElementById("autocopyStrings");
    			tooltip.setAttribute("value", strings.getString("statusbar-tooltip-enabled"));
    		}
    	}
    
    
    }
    
    
    
    
    
    
    function initAutoCopyStatus() 
    {
    	initPreferences();
    
    	document.getElementById("cmd_selectAll").setAttribute("oncommand", "goDoCommand('cmd_selectAll'); AutocopySelectAll();");
    
    
        	var strings = document.getElementById("autocopyStrings");
    
    
    	var autocopyLocalizationPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.{0FED7D55-65D4-47b6-A6DE-9A4ADB55355F}.");
    	var autocopylocaledescription = strings.getString("autocopy-description");
    	var str = Components.classes[ "@mozilla.org/supports-string;1" ].createInstance( Components.interfaces.nsISupportsString );
    	str.data = autocopylocaledescription;
    	autocopyLocalizationPrefs.setComplexValue( "description", Components.interfaces.nsISupportsString, str );
    
    
    
    	var autocopyStatusBarButtonPanel = document.getElementById('autocopy-statuspanel');
    	var autocopyStatusBarButton = document.getElementById('autocopy-status');
    	var autocopyStatusBarButtonImage = document.getElementById('autocopy-status-image');
    	var autocopyStatusBarButtonTooltip = document.getElementById('autocopy-tooltip-value');
    	if(autocopyStatusBarButton && autocopyStatusBarButtonImage)
    	{
    
    
    		if(autocopyPrefs.getBoolPref("optStatusBar")){
            	    if(autocopyStatusBarButtonPanel.collapsed)
    		    {
            	    	   autocopyStatusBarButtonPanel.collapsed = false;
    		    }
            	}
            	else{
            	    if(!autocopyStatusBarButtonPanel.collapsed)
    		    {
            	    	   autocopyStatusBarButtonPanel.collapsed = true;
    		    }
            	}
    
    
    
    		if (autocopyPrefs.getIntPref("StatusBarState") == 0)
    	        {
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    		                 autocopyStatusBarButton.setAttribute("status", "disabled");
    					autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyDisabled.png");
    	        	         autocopyStatusBarButtonTooltip.setAttribute("value", strings.getString("statusbar-tooltip-disabled"));
    	        	 }
    		}
    		else
    		{
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    	                 	autocopyStatusBarButton.setAttribute("status", "enabled");
    				autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    	                 	autocopyStatusBarButtonTooltip.setAttribute("value", strings.getString("statusbar-tooltip-enabled"));
    			 }
    		}
    
    
    	}
    
    
    
    
    
    
    
    
    	var AutocopyFirebirdmenuitem = document.getElementById('autocopy-firebirdmenuitem');
    	var AutocopyFirebirdmenuitemseparator = document.getElementById('autocopy-firebirdmenuitemseparator');
    	if(AutocopyFirebirdmenuitem)
    	{
    		if (autocopyPrefs.getIntPref("StatusBarState") == 0)
    	        {
    	                 AutocopyFirebirdmenuitem.setAttribute("checked", false);
    		}
    		else
    		{
    	                 AutocopyFirebirdmenuitem.setAttribute("checked", true);
    		}
    
    
    	        if(autocopyPrefs.getBoolPref("optEditMenuItem")){
    		    AutocopyFirebirdmenuitemseparator.setAttribute("hidden", false);
    	            AutocopyFirebirdmenuitem.setAttribute("hidden", false);
    	        }
    	        else{
    		    AutocopyFirebirdmenuitemseparator.setAttribute("hidden", true);
    	            AutocopyFirebirdmenuitem.setAttribute("hidden", true);
    	        }
    	}
    
    
    	var AutocopyFirebirdcontextmenuitem = document.getElementById('autocopy-firebirdcontextmenuitem');
    	if(AutocopyFirebirdcontextmenuitem)
    	{
    
    		if(document.getElementById("contentAreaContextMenu"))
    		{
    			document.getElementById("contentAreaContextMenu").addEventListener("popupshowing",autocopyContextHide,false);
    	        }	
    	}
    
    
    
    
    	var Autocopykeytoggleautocopyenabled = null;
    	if(document.getElementById('firebirdkey-toggle-autocopyenabled'))
    		Autocopykeytoggleautocopyenabled = document.getElementById('firebirdkey-toggle-autocopyenabled');
    	if(document.getElementById('mozillakey-toggle-autocopyenabled'))
    		Autocopykeytoggleautocopyenabled = document.getElementById('mozillakey-toggle-autocopyenabled');
    	if(document.getElementById('thunderbirdkey-toggle-autocopyenabled'))
    		Autocopykeytoggleautocopyenabled = document.getElementById('thunderbirdkey-toggle-autocopyenabled');
    
    
    	if(Autocopykeytoggleautocopyenabled)
    	{
    	        if(autocopyPrefs.getBoolPref("optKeyboardShortcutEnabled")){
    
    	            var optModifiers = "";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyAccel"))
    	                optModifiers = optModifiers + ",accel";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyMeta"))
    	                optModifiers = optModifiers + ",meta";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyCtrl"))
    	                optModifiers = optModifiers + ",control";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyShift"))
    	                optModifiers = optModifiers + ",shift";
    	            if(autocopyPrefs.getBoolPref("optKeyboardShortcutKeyAlt"))
    	                optModifiers = optModifiers + ",alt";
    
    	            optModifiers.replace(/^\,/,"");
    
    	            var optKey = autocopyPrefs.getCharPref("optKeyboardShortcutKey");
    	            if(optKey.match(/^[A-Z]$/i)){
    	                Autocopykeytoggleautocopyenabled.setAttribute("key", optKey);
    	                Autocopykeytoggleautocopyenabled.setAttribute("keycode", "");
    	            }
    	            else{
    	                Autocopykeytoggleautocopyenabled.setAttribute("key", "");
    	                Autocopykeytoggleautocopyenabled.setAttribute("keycode", optKey);
    	            }
    
    	            Autocopykeytoggleautocopyenabled.setAttribute("modifiers", optModifiers);
    	            Autocopykeytoggleautocopyenabled.setAttribute("disabled", false);
    	        }
    	        else{
    	            Autocopykeytoggleautocopyenabled.setAttribute("disabled", true);
    	        }
    	}
    
    
    
    
    	PasteOnMiddleClickStatusbarOption =  document.getElementById('autocopy-statusbar-PasteOnMiddleClick');
    	if(PasteOnMiddleClickStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	EnableInTextBoxesStatusbarOption =  document.getElementById('autocopy-statusbar-EnableInTextBoxes');
    	if(EnableInTextBoxesStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    		{
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	AutocopyContextMenuStatusbarOption =  document.getElementById('autocopy-statusbar-AutocopyContextMenu');
    	if(AutocopyContextMenuStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optContextMenu"))
    		{
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	StatusbarBlinkStatusbarOption =  document.getElementById('autocopy-statusbar-StatusbarBlink');
    	if(StatusbarBlinkStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optStatusbarBlink"))
    		{
    			StatusbarBlinkStatusbarOption.setAttribute("checked", true);
    		}
    		else
    		{
    			StatusbarBlinkStatusbarOption.setAttribute("checked", false);
    		}
    	}
    
    
    	StatusbarDeselectAfterCopy =  document.getElementById('autocopy-statusbar-DeselectAfterCopy');
    	if(StatusbarDeselectAfterCopy)
    	{
    		if (autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    		{
    			StatusbarDeselectAfterCopy.setAttribute("checked", true);
    		}
    		else
    		{
    			StatusbarDeselectAfterCopy.setAttribute("checked", false);
    		}
    	}
    
    
    
    
    
    
    
    
    }
    
    
    /////////////////
    //
    //window.addEventListener("load",function() {AutoCopyCopyOnLoad();} ,true);
    //
    //function AutoCopyCopyOnLoad()
    //{
    //////////////////
    //goDoCommand('cmd_selectAll');
    //AutocopySelectAll();
    //Autocopy_DeselectAfterCopy_CollapseSelection()
    //}
    /////////////////
    
    
    function resetAutoCopyStatus()
    {
        initAutoCopyStatus()
    }
    
    
    
    
    function initPreferences(){
    
    
    	if (!autocopyPrefs.prefHasUserValue("StatusBarState"))
    		autocopyPrefs.setIntPref("StatusBarState", 1)
    
    
    	if (!autocopyPrefs.prefHasUserValue("optPasteOnMiddleClick"))
    		autocopyPrefs.setBoolPref("optPasteOnMiddleClick", true);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optDeselectAfterCopy"))
    	{
    		if(navigator.vendor.match(/Thunderbird/i))
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", false);
    		}
    	}
    
    
    
    
    	if (!autocopyPrefs.prefHasUserValue("optCopyWithoutFormating"))
    		autocopyPrefs.setBoolPref("optCopyWithoutFormating", false);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optStatusBar"))
    		autocopyPrefs.setBoolPref("optStatusBar", true);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optStatusbarBlink"))
    		autocopyPrefs.setBoolPref("optStatusbarBlink", true);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optContextMenu"))
    		autocopyPrefs.setBoolPref("optContextMenu", false);
    
    
    
    
    	if (!autocopyPrefs.prefHasUserValue("optContextMenuHideTimeout"))
    		autocopyPrefs.setIntPref("optContextMenuHideTimeout", 2000);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optEditMenuItem"))
    		autocopyPrefs.setBoolPref("optEditMenuItem", false);
    	if (!autocopyPrefs.prefHasUserValue("optContextMenuItem"))
    		autocopyPrefs.setBoolPref("optContextMenuItem", true);
    	if (!autocopyPrefs.prefHasUserValue("optEnableInTextBoxes"))
    		autocopyPrefs.setBoolPref("optEnableInTextBoxes", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutEnabled"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutEnabled", false);
    
    
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyAccel"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyAccel", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyMeta"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyMeta", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyCtrl"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyCtrl", true);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyShift"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyShift", true);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKeyAlt"))
    		autocopyPrefs.setBoolPref("optKeyboardShortcutKeyAlt", false);
    	if (!autocopyPrefs.prefHasUserValue("optKeyboardShortcutKey"))
    		autocopyPrefs.setCharPref("optKeyboardShortcutKey", "C");
    }
    
    
    
    
    
    
    
    
    function switchautocopystatusstate()
    {
            if (autocopyPrefs.getIntPref("StatusBarState") == 0)
            {
    		autocopyPrefs.setIntPref("StatusBarState", 1);
            }
            else
            {
    		autocopyPrefs.setIntPref("StatusBarState", 0);
            }
            initAutoCopyStatus();
    }
    
    
    function autocopy_onKeyUpCheck(e)
    {
    	if(e.keyCode == e.DOM_VK_A && e.ctrlKey)
    	{
    		autocopyOnMouseUp(e);
    	}
    }
    
    
    
    
    function autocopyOnMouseUp(e)
    {
       if ((!e.ctrlKey) || (e.keyCode))
       {
    	var targetclassname = e.target.toString();
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    		if(!targetclassname.match(/SelectElement|OptionElement/i))
    		{
    			if(!Autocopy_isTargetEditable(e.target))
    			{
    				if (!targetclassname.match(/object XUL/i))
    				{
    
    
    					if((autocopy_getSelection().length > 0) && (gautocopy_lastSelection != autocopy_getSelection()))
    					{
    						//were going to copy
    						gautocopy_lastSelection = autocopy_getSelection();
    						autocopy_saveclipboard();
    						if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    						{
    							copyplaintext();
    						}
    						else
    						{
    							goDoCommand('cmd_copy');
    						}
    						if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    						{
    							AutocopyBlinkStatusbarButton(3);
    						}
    						if (autocopyPrefs.getBoolPref("optContextMenu"))
    						{
    							var x = e.screenX;
    							var y = e.screenY;
    							if(x == 0 && y == 0)
    							{
    								document.popupNode = document.documentElement;
    								document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    								autocopy_timedhidemenu(); 
    							}
    							else
    							{
    								document.popupNode = null;
    								document.getElementById('autocopy-context-menu').showPopup(document.documentElement, x, y, "context");
    								autocopy_timedhidemenu(); 
    							}
    						}
    						if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    						{
    							Autocopy_DeselectAfterCopy();
    						}
    					}
    				}
    			}
    			else if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    			{
    				if((autocopy_getSelection().length > 0) && (gautocopy_lastSelection != autocopy_getSelection()))
    				{
    					//were going to copy
    					gautocopy_lastSelection = autocopy_getSelection();
    					autocopy_saveclipboard();
    					if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    					{
    						//copyplaintext dosn't work in textboxes
    						//copyplaintext();
    						goDoCommand('cmd_copy');
    					}
    					else
    					{
    						goDoCommand('cmd_copy');
    					}
    					if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    					{
    						AutocopyBlinkStatusbarButton(3);
    					}
    					if (autocopyPrefs.getBoolPref("optContextMenu"))
    					{
    						var x = e.screenX;
    						var y = e.screenY;
    						if(x == 0 && y == 0)
    						{
    							document.popupNode = document.documentElement;
    							document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    							autocopy_timedhidemenu(); 
    						}
    						else
    						{
    							document.popupNode = null;
    							document.getElementById('autocopy-context-menu').showPopup(document.documentElement, x, y, "context");
    							autocopy_timedhidemenu(); 
    						}
    					}
    					if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    					{
    						Autocopy_DeselectAfterCopy();
    					}
    				}
    			}
    		}
       	}
       }
    }
    
    
    
    
    function AutocopySelectAll()
    {
    	var targetclassname = "";
    	if(document.commandDispatcher.focusedElement)
    	{	
    		targetclassname = document.commandDispatcher.focusedElement.toString();
    	}
    
    
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    //		if (!targetclassname.match(/object XUL/i))
    //		{
    			if(!targetclassname.match(/SelectElement|OptionElement/i))
    			{
    				if(!Autocopy_isTargetEditableDispatcher(document.commandDispatcher))
    				{
    					if(autocopy_getSelection().length > 0)
    					{
    						//were going to copy
    						gautocopy_lastSelection = autocopy_getSelection();
    						autocopy_saveclipboard();
    						if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    						{
    							copyplaintext();
    						}
    						else
    						{
    							goDoCommand('cmd_copy');
    						}
    						if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    						{
    							AutocopyBlinkStatusbarButton(3);
    						}
    						if (autocopyPrefs.getBoolPref("optContextMenu"))
    						{
    							document.popupNode = document.documentElement;
    							document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    							autocopy_timedhidemenu(); 
    						}
    						if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    						{
    							Autocopy_DeselectAfterCopy();
    						}
    					}
    				}
    				else if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    				{
    					if((autocopy_getSelection().length > 0) && (gautocopy_lastSelection != autocopy_getSelection()))
    					{
    						gautocopy_lastSelection = autocopy_getSelection();
    						autocopy_saveclipboard();
    						if(autocopyPrefs.getBoolPref("optCopyWithoutFormating"))
    						{
    							//copyplaintext dosn't work in textboxes
    							//copyplaintext();
    							goDoCommand('cmd_copy');
    						}
    						else
    						{
    							goDoCommand('cmd_copy');
    						}
    						if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    						{
    							AutocopyBlinkStatusbarButton(3);
    						}
    						if (autocopyPrefs.getBoolPref("optContextMenu"))
    						{
    								document.popupNode = document.documentElement;
    								document.getElementById('autocopy-context-menu').showPopup(document.documentElement, document.documentElement.boxObject.x, document.documentElement.boxObject.y + 100, "context");
    								autocopy_timedhidemenu(); 
    						}
    						if(autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    						{
    							Autocopy_DeselectAfterCopy();
    						}
    					}
    				}
    			}
    //		}
    	}
    }
    
    
    
    
    function Autocopy_Pasteonmiddleclick_mousedown(e)
    {
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    		if((!e.ctrlKey) && autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			if(e.button == 1)
    			{
    				gautocopy_doPaste = false;	
    
    
    				if(e.target.inputField)
    				{
    					if(e.target.inputField.toString().match(/InputElement|TextAreaElement/i))
    					{
    						gautocopy_doPaste = true;
    					}
    				}	
    				if(e.target.mTextbox)
    				{
    					if(e.target.mTextbox.inputField)
    					{
    						if(e.target.mTextbox.inputField.toString().match(/InputElement|TextAreaElement/i))
    						{
    							gautocopy_doPaste = true;
    						}
    					}
    				}
    				if(Autocopy_isTargetEditable(e.target))
    				{
    					gautocopy_doPaste = true;
    				}
    
    				if(gautocopy_doPaste)
    				{
    					if (getBrowser().mCurrentBrowser.autoscrollEnabled) 
    					{
    						getBrowser().mCurrentBrowser._autoScrollPopup.hidePopup();
    						getBrowser().mCurrentBrowser.stopScroll();
    					}
    				}
    			}
    		}
    	}	
    }
    function Autocopy_Pasteonmiddleclick_mouseup(e)
    {
    	if(autocopyPrefs.getIntPref("StatusBarState") == 1)
    	{
    		if((!e.ctrlKey) && autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			if(e.button == 1)
    			{
    				if(gautocopy_doPaste)
    				{
    					goDoCommand('cmd_paste');
    					if (getBrowser().mCurrentBrowser.autoscrollEnabled) 
    					{
    						getBrowser().mCurrentBrowser._autoScrollPopup.hidePopup();
    						getBrowser().mCurrentBrowser.stopScroll();
    					}
    				}
    			}
    		}
    	}	
    }
    
    
    
    
    
    
    
    
    function Autocopy_isTargetEditable(target)
    {
    if(target)
    {
      if(target.toString().match(/InputElement|TextAreaElement/i))
      {
        return true;
      }
    
    
      if(target.textbox)
      {
        return true;
      }
    
    
      if(target.ownerDocument)
      {
        if(target.ownerDocument.designMode)
        {
          if(target.ownerDocument.designMode.match(/on/i))
          {
            return true;
          }
        }
      }
    }
    return false;
    }
    
    
    
    
    
    
    
    
    function Autocopy_isTargetEditableDispatcher(commandDispatcher)
    {
    
    
    	
    	if(commandDispatcher.focusedElement)
    	{
    		if(commandDispatcher.focusedElement.toString().match(/InputElement|TextAreaElement/i))
    		{
    			return true;
    		}
    	}
    	else
    	{
    		if(commandDispatcher.focusedWindow.document.designMode)
    		{
    			if(commandDispatcher.focusedWindow.document.designMode.match(/on/i))
    			{
    				return true;
    			}
    		}
    	}
    
    
    	return false;
    }
    
    
    function Autocopy_DeselectAfterCopy()
    {
    
    
    	if(autocopyPrefs.getBoolPref("optStatusbarBlink"))
    	{
    		var focusedElement = document.commandDispatcher.focusedElement;
    		if(focusedElement)
    		{
    			SelectionLength = focusedElement.selectionEnd - focusedElement.selectionStart;
    			Autocopy_DeselectAfterCopy_CollapseSelection_TextBox()
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection_TextBox, 25, SelectionLength); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection_TextBox, 50); 
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection_TextBox, 75, SelectionLength); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection_TextBox, 100); 	
    		}
    		else
    		{
    			var focusedWindow = document.commandDispatcher.focusedWindow;
    			try
    			{
    				var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    				var Selection = winWrapper.getSelection();
    			}
    			catch(e)
    			{
    				var Selection = focusedWindow.getSelection();
    			}
    			var SelectionfocusNode = Selection.focusNode;
    			var SelectionfocusOffset = Selection.focusOffset;
    			Autocopy_DeselectAfterCopy_CollapseSelection()
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection, 25, SelectionfocusNode, SelectionfocusOffset); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection, 50); 
    			setTimeout(Autocopy_DeselectAfterCopy_ExtendSelection, 75, SelectionfocusNode, SelectionfocusOffset); 
    			setTimeout(Autocopy_DeselectAfterCopy_CollapseSelection, 100); 	
    		}
    	}
    	else
    	{	
    		var focusedElement = document.commandDispatcher.focusedElement;
    		if(focusedElement)
    		{		
    			Autocopy_DeselectAfterCopy_CollapseSelection_TextBox()
    		}
    		else
    		{
    			goDoCommand('cmd_selectNone');
    		}
    	}
    }
    function Autocopy_DeselectAfterCopy_ExtendSelection_TextBox(SelectionLength)
    {
    	var focusedElement = document.commandDispatcher.focusedElement;
    	if(focusedElement)
    	{
    		focusedElement.selectionEnd = focusedElement.selectionStart + SelectionLength;
    	}
    }
    function Autocopy_DeselectAfterCopy_CollapseSelection_TextBox()
    {
    	var focusedElement = document.commandDispatcher.focusedElement;
    	if(focusedElement)
    	{
    		focusedElement.selectionEnd = focusedElement.selectionStart;
    	}
    }
    function Autocopy_DeselectAfterCopy_ExtendSelection(SelectionfocusNode, SelectionfocusOffset)
    {
    	var focusedWindow = document.commandDispatcher.focusedWindow;
    	try
    	{
    		var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    		var Selection = winWrapper.getSelection();
    	}
    	catch(e)
    	{
    		var Selection = focusedWindow.getSelection();
    	}
    	Selection.extend(SelectionfocusNode, SelectionfocusOffset);
    }
    function Autocopy_DeselectAfterCopy_CollapseSelection()
    {
    	var focusedWindow = document.commandDispatcher.focusedWindow;
    	try
    	{
    		var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    		var Selection = winWrapper.getSelection();
    	}
    	catch(e)
    	{
    		var Selection = focusedWindow.getSelection();
    	}
    	var SelectionanchorNode = Selection.anchorNode;
    	var SelectionanchorOffset = Selection.anchorOffset;
    	Selection.collapse(SelectionanchorNode, SelectionanchorOffset);
    }
    
    
    
    
    
    
    function AutocopyBlinkStatusbarButton(numberofblinks)
    {
    	setTimeout(AutocopyBlinkStatusbarButton, 5000, 0); //resets in 5 seconds just incase
    
    
    	var autocopyStatusBarButton = document.getElementById('autocopy-status');
    	var autocopyStatusBarButtonImage = document.getElementById('autocopy-status-image');
    	var autocopyStatusBarButtonTooltip = document.getElementById('autocopy-tooltip-value');
    	if (numberofblinks > 0)
    	{
    		if (autocopyPrefs.getIntPref("StatusBarState") != 0)
    		{
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    				if(autocopyStatusBarButtonImage.getAttribute("src") == "chrome://autocopy/skin/AutoCopyEnabled.png")
    				{
    					autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyBlank.png");
    				}
    				else
    				{
    					autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    				}
    				numberofblinks = numberofblinks - 1;
    		     		setTimeout(AutocopyBlinkStatusbarButton, 300, numberofblinks);
    			 }
    		}
    	}
    	else
    	{
    		if (autocopyPrefs.getIntPref("StatusBarState") != 0)
    		{
    			 if(autocopyPrefs.getBoolPref("optStatusBar")){
    				autocopyStatusBarButtonImage.setAttribute("src", "chrome://autocopy/skin/AutoCopyEnabled.png");
    			 }
    		}
    	}
    }
    
    
    
    
    function autocopy_getSelection() 
    {
    	var SelectionText = "";
    	var trywindow = false;
    
    	var focusedElement = document.commandDispatcher.focusedElement;
    	if(focusedElement && null != focusedElement)
    	{
    		try
    		{
    			SelectionText = focusedElement.value.substring(focusedElement.selectionStart, focusedElement.selectionEnd);
    		}
    		catch(e)
    		{
    			trywindow = true;
    		}
    	}
    	else
    	{
    		trywindow = true;
    	}
    
    	if(trywindow)
    	{
    		var focusedWindow = document.commandDispatcher.focusedWindow;
    		try
    		{
    			var winWrapper = new XPCNativeWrapper(focusedWindow, 'document', 'getSelection()');
    			var Selection = winWrapper.getSelection();
    		}
    		catch(e)
    		{
    			var Selection = focusedWindow.getSelection();
    		}
    		SelectionText = Selection.toString();
    
    
    	}
    	return SelectionText;
    }
    
    
    function autocopy_getClipboardContents()
    {
    	var clip = Components.classes["@mozilla.org/widget/clipboard;1"].
                 getService(Components.interfaces.nsIClipboard);
    	if (!clip) return false;
    
    
    	var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    	if (!trans) return false;
    		trans.addDataFlavor("text/unicode");
    
    
    	clip.getData(trans,clip.kGlobalClipboard);
    
    
    	var str = new Object();
    	var strLength = new Object();
    
    
    	try{
    		trans.getTransferData("text/unicode",str,strLength);
    	}
    	catch(e){	
    		return false;
    	}
    	if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
    	if (str) pastetext = str.data.substring(0,strLength.value / 2);
    
    	return pastetext;
    }
    
    
    function autocopy_setClipboardContents(copytext)
    {	
    	try{
    		var str = Components.classes["@mozilla.org/supports-string;1"].
                createInstance(Components.interfaces.nsISupportsString);
    		if (!str) return false;
    		str.data = copytext;
    
    
    		var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    		if (!trans) return false;
    
    
    
    
    		trans.addDataFlavor("text/unicode");
    		trans.setTransferData("text/unicode",str,copytext.length * 2);
    
    
    		var clipid = Components.interfaces.nsIClipboard;
    		var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
    		if (!clip) return false;
    
    
    		clip.setData(trans,null,clipid.kGlobalClipboard);
    		return true;
    	}
    	catch(e)
    	{
    		return false;
    	}
    }
    
    
    function autocopy_setClipboardContentsHtml(copyhtml, copytext)
    {	
    	try{
    		var strhtml = Components.classes["@mozilla.org/supports-string;1"].
                createInstance(Components.interfaces.nsISupportsString);
    		if (!strhtml) return false;
    		strhtml.data = copyhtml;
    
    
    		var str = Components.classes["@mozilla.org/supports-string;1"].
                createInstance(Components.interfaces.nsISupportsString);
    		if (!str) return false;
    		str.data = copytext;
    
    
    		var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    		if (!trans) return false;
    
    
    		trans.addDataFlavor("text/html");
    		trans.setTransferData("text/html",strhtml,copyhtml.length * 2);
    
    
    		trans.addDataFlavor("text/unicode");
    		trans.setTransferData("text/unicode",str,copytext.length * 2);
    
    
    
    
    		var clipid = Components.interfaces.nsIClipboard;
    		var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
    		if (!clip) return false;
    
    
    		clip.setData(trans,null,clipid.kGlobalClipboard);
    
    
    		autocopy_saveclipboard()
    
    
    		return true;
    	}
    	catch(e)
    	{
    		return false;
    	}
    }
    
    
    
    
    function autocopy_saveclipboard()
    {
    	var clip = Components.classes["@mozilla.org/widget/clipboard;1"].
                 getService(Components.interfaces.nsIClipboard);
    	if (!clip) return false;
    
    
    	var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                  createInstance(Components.interfaces.nsITransferable);
    	if (!trans) return false;
    
    
    	var importflavors = trans.flavorsTransferableCanImport();	
    	var exportflavors = trans.flavorsTransferableCanExport();	
    
    
    	trans.addDataFlavor("text/unicode");
    
    
    	clip.getData(trans,clip.kGlobalClipboard);
    
    
    	var dataType = new Object();
    	var data = new Object();
    	var dataLength = new Object();
    
    
    	try{
    		trans.getAnyTransferData(dataType, data, dataLength);
    	}
    	catch(e){	
    		return false;
    	}
    
    
    	var autocopy_clipboardcontents = new AutocopyClipboardContents(dataType, data, dataLength);
    	gautocopy_clipboardcontents.unshift(autocopy_clipboardcontents); //adds to the begining of array
    	if(gautocopy_clipboardcontents.length > 10 + 1)  
    	{
    		gautocopy_clipboardcontents.pop();  //remove last one if length to long
    	}
    
    
    	return true;
    
    
    }
    
    
    function autocopy_replaceoldclipboard(aIndex)
    {
    	try
    	{
    		if(gautocopy_clipboardcontents[aIndex])
    		{
    
    
    			if(autocopy_saveclipboard())
    			{
    				aIndex = aIndex + 1;
    
    
    				var trans = Components.classes["@mozilla.org/widget/transferable;1"].
        			          createInstance(Components.interfaces.nsITransferable);
    				if (!trans) return false;
    
    
    				trans.addDataFlavor(gautocopy_clipboardcontents[aIndex].dataType);
    				trans.setTransferData(gautocopy_clipboardcontents[aIndex].dataType.value, gautocopy_clipboardcontents[aIndex].data.value, gautocopy_clipboardcontents[aIndex].dataLength.value);
    
    
    				var clipid = Components.interfaces.nsIClipboard;
    				var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
    				if (!clip) return false;
    
    
    				clip.setData(trans,null,clipid.kGlobalClipboard);
    
    				if(aIndex > 1)
    				{
    					//move selected clipboardcontents to the begining of the clipboard array
    					var autocopy_clipboardcontents = gautocopy_clipboardcontents[aIndex];
    					gautocopy_clipboardcontents.splice(aIndex,1);
    				}
    				return true;
    			}
    			else
    			{	
    				return false;
    			}
    		}
    	}
    	catch(e)
    	{
    		return false;
    	}
    }
    
    
    function autocopy_pastetolocationbar()
    {
    	var str = autocopy_getClipboardContents();
    	if(str)
    	{
    		var urlbar = document.getElementById('urlbar');
    		urlbar.value = str;
    		urlbar.focus();
    	}
    }
    
    
    function autocopy_pastetosearchbar()
    {
    	var str = autocopy_getClipboardContents();
    	if(str)
    	{
    		var searchbar = document.getElementById('searchbar');
    		if(searchbar)
    		{
    			if(searchbar.textbox.value)
    			{
    				searchbar.textbox.focus();
    				searchbar.textbox.value = str;
    			}
    			if(searchbar.mTextbox.value)
    			{
    				searchbar.mTextbox.value = str;
    				searchbar.mTextbox.focus();
    			}
    		}
    	}
    
    
    }
    
    
    function autocopy_togglepasteonmiddleclick()
    {
    	PasteOnMiddleClickStatusbarOption =  document.getElementById('autocopy-statusbar-PasteOnMiddleClick');
    	if(PasteOnMiddleClickStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optPasteOnMiddleClick"))
    		{
    			autocopyPrefs.setBoolPref("optPasteOnMiddleClick", false);
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optPasteOnMiddleClick", true);
    			PasteOnMiddleClickStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleEnableInTextBoxes()
    {
    	EnableInTextBoxesStatusbarOption =  document.getElementById('autocopy-statusbar-EnableInTextBoxes');
    	if(EnableInTextBoxesStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optEnableInTextBoxes"))
    		{
    			autocopyPrefs.setBoolPref("optEnableInTextBoxes", false);
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optEnableInTextBoxes", true);
    			EnableInTextBoxesStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleAutocopyContextMenu()
    {
    	AutocopyContextMenuStatusbarOption =  document.getElementById('autocopy-statusbar-AutocopyContextMenu');
    	if(AutocopyContextMenuStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optContextMenu"))
    		{
    			autocopyPrefs.setBoolPref("optContextMenu", false);
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optContextMenu", true);
    			AutocopyContextMenuStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleStatusbarBlink()
    {
    	StatusbarBlinkStatusbarOption =  document.getElementById('autocopy-statusbar-StatusbarBlink');
    	if(StatusbarBlinkStatusbarOption)
    	{
    		if (autocopyPrefs.getBoolPref("optStatusbarBlink"))
    		{
    			autocopyPrefs.setBoolPref("optStatusbarBlink", false);
    			StatusbarBlinkStatusbarOption.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optStatusbarBlink", true);
    			StatusbarBlinkStatusbarOption.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_toggleDeselectAfterCopy()
    {
    	StatusbarDeselectAfterCopy =  document.getElementById('autocopy-statusbar-DeselectAfterCopy');
    	if(StatusbarDeselectAfterCopy)
    	{
    		if (autocopyPrefs.getBoolPref("optDeselectAfterCopy"))
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", false);
    			StatusbarDeselectAfterCopy.setAttribute("checked", false);
    		}
    		else
    		{
    			autocopyPrefs.setBoolPref("optDeselectAfterCopy", true);
    			StatusbarDeselectAfterCopy.setAttribute("checked", true);
    		}
    	}
    }
    
    
    function autocopy_appendurltoclipboard() 
    {	
    	var clipboardcontents = autocopy_getClipboardContents();
    	if(clipboardcontents)
    	{
    		var copytext = clipboardcontents + "\r\n\r\n" + window.content.location.href;
    
    
    		var copyhtml = clipboardcontents + "\r\n <br><br>(From: <a href=\"" + window.content.location.href + "\">" + window.content.location.href + ")</a>";
    
    
    		autocopy_setClipboardContents(copytext);
    	}
    }
    
    
    function autocopy_timedhidemenu()
    {
    	window.clearTimeout(gautocopy_hidemenu_timer);
    	var timerinterval = autocopyPrefs.getIntPref("optContextMenuHideTimeout");
    	if(timerinterval > 0)
    	{
    		//if timer interval option is less then or equal to zero then don't timer hide the menu
    		gautocopy_hidemenu_timer = setTimeout("autocopy_hide_contextMenu();", timerinterval, 0); 
    	}
    }
    
    
    function autocopy_canceltimedhidemenu()
    {
    	window.clearTimeout(gautocopy_hidemenu_timer);
    }
    function autocopy_hide_contextMenu()
    {
    	document.getElementById('autocopy-context-menupopup-clipboards').hidePopup();
    	document.getElementById('autocopy-context-menu').hidePopup();
    }
    
    
    function autocopy_contextmenu_onpopupshowing(e)
    {
        	var strings = document.getElementById("autocopyStrings");
    	var localizedstringSearchFor = strings.getString("autocopy-context-menu-searchfor");
    	var searchformenuitem = document.getElementById('autocopy-context-menu-searchforselection');
    	if(searchformenuitem)
    	{
    		var SelectionText = autocopy_getSelection();
    		if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    		{
    			SelectionText = gautocopy_lastSelection;
    		}
    		if(SelectionText)
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' "' + SelectionText.substring(0,12) + '..."');
    		}
    		else
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' ');
    		}
    	}	
    
    
    } 
    
    
    function autocopy_context_onpopupshowing(e)
    {
        	var strings = document.getElementById("autocopyStrings");
    	var localizedstringSearchFor = strings.getString("autocopy-context-menu-searchfor");
    	var searchformenuitem = document.getElementById('autocopy-context-searchforselection');
    	if(searchformenuitem)
    	{
    		var SelectionText = autocopy_getSelection();
    		if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    		{
    			SelectionText = gautocopy_lastSelection;
    		}
    		if(SelectionText)
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' "' + SelectionText.substring(0,12) + '..."');
    		}
    		else
    		{
    			searchformenuitem.setAttribute('label', localizedstringSearchFor + ' ');
    		}
    	}	
    
    
    } 
    
    
    
    
    function autocopy_context_menupopup_clipboards_onpopupshowing()
    {
    	var clipboardsmenupopup = document.getElementById('autocopy-context-menupopup-clipboards');
    
    
    	//remove all menuitems
    	while(clipboardsmenupopup.childNodes.length > 0)
    	{
    		clipboardsmenupopup.removeChild(clipboardsmenupopup.childNodes[0]);
    	}
    
    
    	if(gautocopy_clipboardcontents.length > 0)
    	{
    		for(var x = 0; x < gautocopy_clipboardcontents.length & x < 10; x++)
    		{
    			var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
    			if (!trans) return false;
    
    			trans.addDataFlavor(gautocopy_clipboardcontents[x].dataType.value);
    			trans.setTransferData(gautocopy_clipboardcontents[x].dataType.value, gautocopy_clipboardcontents[x].data.value, gautocopy_clipboardcontents[x].dataLength.value);
    
    
    			var str = new Object();
    			var strLength = new Object();
    
    
    			try{
    				trans.getTransferData(gautocopy_clipboardcontents[x].dataType.value,str,strLength);
    			}
    			catch(e){	
    				return false;
    			}
    			if(gautocopy_clipboardcontents[x].dataType.value == "text/unicode")
    			{
    				if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
    				if (str) pastetext = str.data.substring(0,strLength.value / 2);
    
    
    				var item = document.createElement('menuitem');
    				item.setAttribute('oncommand', "autocopy_replaceoldclipboard(" + x + ");");
    				item.setAttribute('label', pastetext.substring(0,24));
    				clipboardsmenupopup.appendChild(item);
    			}
    		}
    	}
    } 
    
    
    
    
    function autocopy_context_menupopup_clipboards2_onpopupshowing()
    {
    	var clipboardsmenupopup = document.getElementById('autocopy-context-menupopup-clipboards2');
    
    
    	//remove all menuitems
    	while(clipboardsmenupopup.childNodes.length > 0)
    	{
    		clipboardsmenupopup.removeChild(clipboardsmenupopup.childNodes[0]);
    	}
    
    
    	if(gautocopy_clipboardcontents.length > 0)
    	{
    		for(var x = 0; x < gautocopy_clipboardcontents.length & x < 10; x++)
    		{
    			var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
    			if (!trans) return false;
    
    			trans.addDataFlavor(gautocopy_clipboardcontents[x].dataType.value);
    			trans.setTransferData(gautocopy_clipboardcontents[x].dataType.value, gautocopy_clipboardcontents[x].data.value, gautocopy_clipboardcontents[x].dataLength.value);
    
    
    			var str = new Object();
    			var strLength = new Object();
    
    
    			try{
    				trans.getTransferData(gautocopy_clipboardcontents[x].dataType.value,str,strLength);
    			}
    			catch(e){	
    				return false;
    			}
    			if(gautocopy_clipboardcontents[x].dataType.value == "text/unicode")
    			{
    				if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
    				if (str) pastetext = str.data.substring(0,strLength.value / 2);
    
    
    				var item = document.createElement('menuitem');
    				item.setAttribute('oncommand', "autocopy_replaceoldclipboard(" + x + ");");
    				item.setAttribute('label', pastetext.substring(0,24));
    				clipboardsmenupopup.appendChild(item);
    			}
    		}
    	}
    } 
    
    
    
    
    
    
    function autocopy_searchforselection()
    {
    	var SelectionText = autocopy_getSelection();
    	if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    	{
    		SelectionText = gautocopy_lastSelection;
    	}
    	if(BrowserSearch)
    	{
    		BrowserSearch.loadSearch(SelectionText, true)
    	}
    	else
    	{
    		OpenSearch('internet', SelectionText, true);
    	}
    }
    
    
    function autocopy_openinnewtab()
    {
    	var SelectionText = autocopy_getSelection();
    	if(!(SelectionText.length > 0) && gautocopy_lastSelection)
    	{
    		SelectionText = gautocopy_lastSelection;
    	}
    	window.gBrowser.addTab(SelectionText);
    }
    Alles anzeigen
  • userChrome.js Scripte für den Fuchs (Zusammenstellung)

    • loshombre
    • 29. Mai 2011 um 20:07

    Die Scripte zu verlinken ist einfach unmöglich, weil ich sie in tagelanger Suche, manchmal auch per Zufall nach und nach auf meiner Platte zusammen getragen hab. In sofern weiß ich mtw. ehrlich gar nicht mehr, wo ich dat ganze Zeug her hab.
    Ich weiß nicht, ob das Forum mtw. die Möglichkeit bietet, die Scripte hier unverfälscht als Code zu platzieren. Früher, im alten chrome.js-Thread gabs da so manche Probleme damit. Einige davon sind auch so um die 30-40Kb groß.

    Endor Hombre, du hast Post.

  • userChrome.js Scripte für Fuchs 16 (Zusammenstellung) alt

    • loshombre
    • 29. Mai 2011 um 20:07

    Die Scripte zu verlinken ist einfach unmöglich, weil ich sie in tagelanger Suche, manchmal auch per Zufall nach und nach auf meiner Platte zusammen getragen hab. In sofern weiß ich mtw. ehrlich gar nicht mehr, wo ich dat ganze Zeug her hab.
    Ich weiß nicht, ob das Forum mtw. die Möglichkeit bietet, die Scripte hier unverfälscht als Code zu platzieren. Früher, im alten chrome.js-Thread gabs da so manche Probleme damit. Einige davon sind auch so um die 30-40Kb groß.

    Endor Hombre, du hast Post.

  • userChrome.js Scripte für Fuchs 14 (Zusammenstellung)

    • loshombre
    • 29. Mai 2011 um 20:07

    Die Scripte zu verlinken ist einfach unmöglich, weil ich sie in tagelanger Suche, manchmal auch per Zufall nach und nach auf meiner Platte zusammen getragen hab. In sofern weiß ich mtw. ehrlich gar nicht mehr, wo ich dat ganze Zeug her hab.
    Ich weiß nicht, ob das Forum mtw. die Möglichkeit bietet, die Scripte hier unverfälscht als Code zu platzieren. Früher, im alten chrome.js-Thread gabs da so manche Probleme damit. Einige davon sind auch so um die 30-40Kb groß.

    Endor Hombre, du hast Post.

  • userChrome.js Scripte für den Fuchs (Zusammenstellung)

    • loshombre
    • 28. Mai 2011 um 23:49

    22. Conquery // Websuche der Markierung mit allen in der Searchbar verfügbaren Searchplugins aus dem Kontextmenü heraus. Mit Rechtsklick wird mit allen Suchmaschinen in Tabs gleichzeitig gesucht. Mit Doppelklick auf die Websuche wird in mit dem als Standard eingestellten Suchmoped gesucht. Erspart das gleichnamige und/oder ähnliche Addons (Siehe Beispielbild unten).
    23. DownloadSoundPlay // Ein akustischer Hinweis auf das erfolgreiche Ende eines Downloads. Eine beliebige Sounddatei kann im Script frei von der Platte eingebunden werden.
    24. ImageChangeSize // Eine Möglichkeit, vorhandene Webbilder aus dem Kontextmenü heraus in ihrer Größe zu verändern (Siehe Beispielbild unten).
    25. WebScreenShot // Ein neues Menü unter "Extras", mit dem man wunderbar alle möglichen Bereiche einer Webpage fotografieren kann. Dabei werden die Screenshots sofort automatisch (je nach Browser Einstellungen) im neuen Tab im Hintergrund geöffnet. Im Fuchs Kontextmenü wird auch noch eine zusätzliche Funktion gezaubert, eine Grafik direkt als Base64 Code in die Zwischenablage zu kopieren. Ganz coole Nummer, wenn man zB. damit im Stylish rum schraubt (Siehe Beispielbild unten).
    26. StatusbarInURLBar // Hierbei wird quasi die Statusbar, bzw. deren Inhalt (zB. verschiedene Addon-Buttons, die sich, oder man selber dort platzieren möchte) in die Urlbar verfrachtet. Da aber seit Fuchs 4 diese mtw. Addonbar heißt, muss man eben diese Namensgebung im Script ändern. Geht problemlos. Die Addonbar nimmt Platz in der Urlbar und das Browserfenster hat unten mehr Platz. (Siehe Beispielbild unten).

    Zu 22.)
    [Blockierte Grafik: http://img6.imagebanana.com/img/0padm20d/thumb/Zwischenablage04.jpg]

    Zu 24.)
    [Blockierte Grafik: http://img6.imagebanana.com/img/j2fa90nh/thumb/Zwischenablage03.jpg]

    Zu 25.) [Blockierte Grafik: http://img6.imagebanana.com/img/qow02ztn/thumb/Zwischenablage01.jpg][Blockierte Grafik: http://img6.imagebanana.com/img/3eegct1e/thumb/Zwischenablage02.jpg]

    Zu 26.)
    [Blockierte Grafik: http://www.imagebanana.com/img/hidkcrhl/Zwischenablage02.jpg]

  • userChrome.js Scripte für Fuchs 16 (Zusammenstellung) alt

    • loshombre
    • 28. Mai 2011 um 23:49

    22. Conquery // Websuche der Markierung mit allen in der Searchbar verfügbaren Searchplugins aus dem Kontextmenü heraus. Mit Rechtsklick wird mit allen Suchmaschinen in Tabs gleichzeitig gesucht. Mit Doppelklick auf die Websuche wird in mit dem als Standard eingestellten Suchmoped gesucht. Erspart das gleichnamige und/oder ähnliche Addons (Siehe Beispielbild unten).
    23. DownloadSoundPlay // Ein akustischer Hinweis auf das erfolgreiche Ende eines Downloads. Eine beliebige Sounddatei kann im Script frei von der Platte eingebunden werden.
    24. ImageChangeSize // Eine Möglichkeit, vorhandene Webbilder aus dem Kontextmenü heraus in ihrer Größe zu verändern (Siehe Beispielbild unten).
    25. WebScreenShot // Ein neues Menü unter "Extras", mit dem man wunderbar alle möglichen Bereiche einer Webpage fotografieren kann. Dabei werden die Screenshots sofort automatisch (je nach Browser Einstellungen) im neuen Tab im Hintergrund geöffnet. Im Fuchs Kontextmenü wird auch noch eine zusätzliche Funktion gezaubert, eine Grafik direkt als Base64 Code in die Zwischenablage zu kopieren. Ganz coole Nummer, wenn man zB. damit im Stylish rum schraubt (Siehe Beispielbild unten).
    26. StatusbarInURLBar // Hierbei wird quasi die Statusbar, bzw. deren Inhalt (zB. verschiedene Addon-Buttons, die sich, oder man selber dort platzieren möchte) in die Urlbar verfrachtet. Da aber seit Fuchs 4 diese mtw. Addonbar heißt, muss man eben diese Namensgebung im Script ändern. Geht problemlos. Die Addonbar nimmt Platz in der Urlbar und das Browserfenster hat unten mehr Platz. (Siehe Beispielbild unten).

    Zu 22.)
    [Blockierte Grafik: http://img6.imagebanana.com/img/0padm20d/thumb/Zwischenablage04.jpg]

    Zu 24.)
    [Blockierte Grafik: http://img6.imagebanana.com/img/j2fa90nh/thumb/Zwischenablage03.jpg]

    Zu 25.) [Blockierte Grafik: http://img6.imagebanana.com/img/qow02ztn/thumb/Zwischenablage01.jpg][Blockierte Grafik: http://img6.imagebanana.com/img/3eegct1e/thumb/Zwischenablage02.jpg]

    Zu 26.)
    [Blockierte Grafik: http://www.imagebanana.com/img/hidkcrhl/Zwischenablage02.jpg]

  • userChrome.js Scripte für Fuchs 14 (Zusammenstellung)

    • loshombre
    • 28. Mai 2011 um 23:49

    22. Conquery // Websuche der Markierung mit allen in der Searchbar verfügbaren Searchplugins aus dem Kontextmenü heraus. Mit Rechtsklick wird mit allen Suchmaschinen in Tabs gleichzeitig gesucht. Mit Doppelklick auf die Websuche wird in mit dem als Standard eingestellten Suchmoped gesucht. Erspart das gleichnamige und/oder ähnliche Addons (Siehe Beispielbild unten).
    23. DownloadSoundPlay // Ein akustischer Hinweis auf das erfolgreiche Ende eines Downloads. Eine beliebige Sounddatei kann im Script frei von der Platte eingebunden werden.
    24. ImageChangeSize // Eine Möglichkeit, vorhandene Webbilder aus dem Kontextmenü heraus in ihrer Größe zu verändern (Siehe Beispielbild unten).
    25. WebScreenShot // Ein neues Menü unter "Extras", mit dem man wunderbar alle möglichen Bereiche einer Webpage fotografieren kann. Dabei werden die Screenshots sofort automatisch (je nach Browser Einstellungen) im neuen Tab im Hintergrund geöffnet. Im Fuchs Kontextmenü wird auch noch eine zusätzliche Funktion gezaubert, eine Grafik direkt als Base64 Code in die Zwischenablage zu kopieren. Ganz coole Nummer, wenn man zB. damit im Stylish rum schraubt (Siehe Beispielbild unten).
    26. StatusbarInURLBar // Hierbei wird quasi die Statusbar, bzw. deren Inhalt (zB. verschiedene Addon-Buttons, die sich, oder man selber dort platzieren möchte) in die Urlbar verfrachtet. Da aber seit Fuchs 4 diese mtw. Addonbar heißt, muss man eben diese Namensgebung im Script ändern. Geht problemlos. Die Addonbar nimmt Platz in der Urlbar und das Browserfenster hat unten mehr Platz. (Siehe Beispielbild unten).

    Zu 22.)
    [Blockierte Grafik: http://img6.imagebanana.com/img/0padm20d/thumb/Zwischenablage04.jpg]

    Zu 24.)
    [Blockierte Grafik: http://img6.imagebanana.com/img/j2fa90nh/thumb/Zwischenablage03.jpg]

    Zu 25.) [Blockierte Grafik: http://img6.imagebanana.com/img/qow02ztn/thumb/Zwischenablage01.jpg][Blockierte Grafik: http://img6.imagebanana.com/img/3eegct1e/thumb/Zwischenablage02.jpg]

    Zu 26.)
    [Blockierte Grafik: http://www.imagebanana.com/img/hidkcrhl/Zwischenablage02.jpg]

  • userChrome.js Scripte für den Fuchs (Zusammenstellung)

    • loshombre
    • 26. Mai 2011 um 21:40

    21. ExternalApplications // Eine sehr schöne Nummer für n schnellen Zugriff auf externe Anwendungen direkt aus dem Fuchs heraus. Erspart das Addon External Application Buttons. Das Script bring 5 vordefinierte Anwendungen mit, u.a. den IE, CMD, Notepad,... und platziert diese als kleine Icons in der Menubar (Siehe Beispielbild unten). Die Buttons greift das Script aus der Systemvorlage ab, die man mit einem entsprechenden *css Code verändern kann. Man kann nach belieben die Anwendungen selber und deren Reihenfolge, sowie die Anzahl im Script umschrauben. Auch der Positionswechsel in eine andere Toolbar scheint nach meinem Selbstversuch problemlos möglich. Es gibt auch immer einen passenden Tooltip dazu. Ist es einem zu viel mit den ganzen Buttons in der Leiste, kann man dat ganze wunderbar zu einem Menüpunkt zusammen fassen:

    [Blockierte Grafik: http://www.imagebanana.com/img/9w375u8w/Zwischenablage02.jpg] [Blockierte Grafik: http://img6.imagebanana.com/img/lpau0xvd/Zwischenablage02.jpg]

  • userChrome.js Scripte für Fuchs 16 (Zusammenstellung) alt

    • loshombre
    • 26. Mai 2011 um 21:40

    21. ExternalApplications // Eine sehr schöne Nummer für n schnellen Zugriff auf externe Anwendungen direkt aus dem Fuchs heraus. Erspart das Addon External Application Buttons. Das Script bring 5 vordefinierte Anwendungen mit, u.a. den IE, CMD, Notepad,... und platziert diese als kleine Icons in der Menubar (Siehe Beispielbild unten). Die Buttons greift das Script aus der Systemvorlage ab, die man mit einem entsprechenden *css Code verändern kann. Man kann nach belieben die Anwendungen selber und deren Reihenfolge, sowie die Anzahl im Script umschrauben. Auch der Positionswechsel in eine andere Toolbar scheint nach meinem Selbstversuch problemlos möglich. Es gibt auch immer einen passenden Tooltip dazu. Ist es einem zu viel mit den ganzen Buttons in der Leiste, kann man dat ganze wunderbar zu einem Menüpunkt zusammen fassen:

    [Blockierte Grafik: http://www.imagebanana.com/img/9w375u8w/Zwischenablage02.jpg] [Blockierte Grafik: http://img6.imagebanana.com/img/lpau0xvd/Zwischenablage02.jpg]

Unterstütze uns!

Jährlich (2026)

21,3 %

21,3% (138,31 von 650 EUR)

Jetzt spenden
  1. Kontakt
  2. Datenschutz
  3. Impressum
Community-Software: WoltLab Suite™
Mastodon