2 function clipboardcopy(val) {
3 if (window && window.clipboardData) {
5 return window.clipboardData.setData('text', val);
8 if (netscape && netscape.security) {
9 // request access to XPCOM api
11 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
15 alert('Cannot access clipboard.\nSet boolean signed.applets.codebase_principal_support in about:config');
20 // use nsIClipboard interface
22 Components.classes['@mozilla.org/widget/clipboardhelper;1']
23 .getService(Components.interfaces.nsIClipboardHelper)
34 charmatch = /^U\+([0-9A-F]{4,})/;
35 function copycellchars() {
36 var unicode = charmatch.exec(this.title);
37 var str = String.fromCharCode(parseInt(unicode[1], 16));
38 return clipboardcopy(str);
41 var cells = document.getElementsByTagName('TD');
42 for (var i = 0; i < cells.length; i++) {
43 if (!cells[i].title) continue;
44 if (!charmatch.test(cells[i].title)) continue;
45 cells[i].onclick = copycellchars;