rem: dump("# of Nodes selected: " + select_list.length + "\n\n"); 
add: debug("# of Nodes selected: " + select_list.length + "\n\n"); 
context: function copySelectionToClipboard(){	var treeNode = document.getElementById("bookmarksTree");	if (!treeNode)    return(false);	var select_list = treeNode.selectedItems;	if (!select_list)	return(false);	if (select_list.length < 1)    return(false);	dump("# of Nodes selected: " + select_list.length + "\n\n");	var RDF = Components.classes["component://netscape/rdf/rdf-service"].getService();	RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);	if (!RDF)	return(false);	var Bookmarks = RDF.GetDataSource("rdf:bookmarks");	if (!Bookmarks)	return(false);	var nameRes = RDF.GetResource("http://home.netscape.com/NC-rdf#Name");	if (!nameRes)	return(false);	// build a url that encodes all the select nodes as well as their parent nodes	var url="";	for (var nodeIndex=0; nodeIndex<select_list.length; nodeIndex++)	{		var node = select_list[nodeIndex];		if (!node)    continue;		var ID = node.getAttribute("id");		if (!ID)    continue;				var IDRes = RDF.GetResource(ID);		if (!IDRes)	continue;		var nameNode = Bookmarks.GetTarget(IDRes, nameRes, true);		var theName = "";		if (nameNode) nameNode = nameNode.QueryInterface(Components.interfaces.nsIRDFLiteral);		if (nameNode)	theName = nameNode.Value;		dump("Node " + nodeIndex + ": " + ID + "    name: " + theName + "\n");		url += "ID:{" + ID + "};";		url += "NAME:{" + theName + "};";	}	if (url == "")	return(false);	dump("Copy URL: " + url + "\n\n");	// get some useful components	var trans = Components.classes["component://netscape/widget/transferable"].createInstance();	if ( trans ) trans = trans.QueryInterface(Components.interfaces.nsITransferable);	if ( !trans )	return(false);	trans.addDataFlavor("text/unicode");	var clip = Components.classes["component://netscape/widget/clipboard"].createInstance();	if ( clip ) clip = clip.QueryInterface(Components.interfaces.nsIClipboard);	if (!clip)	return(false);	clip.emptyClipboard();	// save bookmark's ID	var data = Components.classes["component://netscape/supports-wstring"].createInstance();	if ( data )	data = data.QueryInterface(Components.interfaces.nsISupportsWString);	if (!data)	return(false);	data.data = url;	trans.setTransferData ( "text/unicode", data, url.length*2 );			// double byte data	clip.setData(trans, null);	return(true);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/6197c55530dd458e95a4a1648fc63abe759aa780/bookmarks.js/buggy/xpfe/components/bookmarks/resources/bookmarks.js