eyesonly
小狐狸
小狐狸
  • UID15850
  • 注册日期2006-11-21
  • 最后登录2009-08-14
  • 发帖数9
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
阅读:2443回复:7

求助:anto copy组件在FF3上不能使用了

楼主#
更多 发布于:2008-06-21 15:36
有没有熟悉这个组件的人给推荐一个其他的
wolfxavier
火狐狸
火狐狸
  • UID12687
  • 注册日期2006-05-11
  • 最后登录2010-06-23
  • 发帖数144
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
1楼#
发布于:2008-06-21 15:36
我这里和同学那里都正常使用
咪姆
非常火狐
非常火狐
  • UID2913
  • 注册日期2005-02-10
  • 最后登录2022-12-13
  • 发帖数951
  • 经验13枚
  • 威望0点
  • 贡献值0点
  • 好评度1点
  • 社区居民
  • 忠实会员
2楼#
发布于:2008-06-21 15:36
改下最大版本号,老的0.64都可以在FF3下正常使用


eyesonly
小狐狸
小狐狸
  • UID15850
  • 注册日期2006-11-21
  • 最后登录2009-08-14
  • 发帖数9
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
3楼#
发布于:2008-06-21 15:36
咪姆:改下最大版本号,老的0.64都可以在FF3下正常使用回到原帖

如何修改版本号?
eyesonly
小狐狸
小狐狸
  • UID15850
  • 注册日期2006-11-21
  • 最后登录2009-08-14
  • 发帖数9
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
4楼#
发布于:2008-06-21 15:36
刚才修改了版本号以后,浏览器提示错误:不能安装未提供安全更新
chicksong
火狐狸
火狐狸
  • UID20617
  • 注册日期2007-09-23
  • 最后登录2023-08-03
  • 发帖数268
  • 经验13枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
5楼#
发布于:2008-06-21 15:36
/* :::::::: AutoCopy ::::::::::::::: */

var gautocopy_lastSelection = null;
var gautocopy_clipboardcontents = new Array();
var gautocopy_doPaste = false;

window.addEventListener("load",function() {initAutoCopyStatus();} ,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;
}


/////////////////
//
//window.addEventListener("load",function() {AutoCopyCopyOnLoad();} ,true);
//
//function AutoCopyCopyOnLoad()
//{
//////////////////
//goDoCommand('cmd_selectAll');
//AutocopySelectAll();
//Autocopy_DeselectAfterCopy_CollapseSelection()
//}
/////////////////



function initPreferences()
{
	if (!autocopyPrefs.prefHasUserValue("optPasteOnMiddleClick"))
		autocopyPrefs.setBoolPref("optPasteOnMiddleClick", true);

	if (!autocopyPrefs.prefHasUserValue("optCopyWithoutFormating"))
		autocopyPrefs.setBoolPref("optCopyWithoutFormating", false);

	if (!autocopyPrefs.prefHasUserValue("optEnableInTextBoxes"))
		autocopyPrefs.setBoolPref("optEnableInTextBoxes", false);
}


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(/object XUL/i))
//		{
			if(!targetclassname.match(/SelectElement|OptionElement/i))
			{
				if(!Autocopy_isTargetEditable(e.target))
				{
					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');
						}
					}
				}
				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');
						}
					}
				}
			}
//		}
   	}
   }
}


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');
						}
					}
				}
				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');
						}
					}
				}
			}
//		}
	}
}


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.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');
				}
			}
		}
	}	
}

function Autocopy_isTargetEditable(target)
{
	if(target)
	{
		if(target.toString().match(/InputElement|TextAreaElement/i))
		{
			return true;
		} 
	}

	if(target)
	{
		if(target.toString().match(/object XUL/i))
		{
			if(target.textbox.value)
			{
				return true;
			}
		} 
	}

	if(target)
	{
		if(target.textbox)
		{
			return true;
		} 
	}

	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_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_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);
	}
}


用0.6X那个版本是可以用上的,最近的0.8总是出问题,于是一气之下用脚本代替了。一样可以!推荐一下楼主吧[/code]
Firefox是头小狐狸,我养的……
chicksong
火狐狸
火狐狸
  • UID20617
  • 注册日期2007-09-23
  • 最后登录2023-08-03
  • 发帖数268
  • 经验13枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
6楼#
发布于:2008-06-21 15:36
对了,用userchrome脚本加进userchrome.js里头哦……
Firefox是头小狐狸,我养的……
eyesonly
小狐狸
小狐狸
  • UID15850
  • 注册日期2006-11-21
  • 最后登录2009-08-14
  • 发帖数9
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
7楼#
发布于:2008-06-21 15:36
终于弄好了,感谢以上几位
游客

返回顶部