Firefox のアドオン Operator を使って ATND から Googleカレンダーにイベントを登録しようとすると "Request-URI Too Large" と言われて失敗するので。
(function(){ function selectByXPath(root, xpath){ if(root === null){ root = document; } var snapshot; try{ snapshot = root.evaluate(xpath, root, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); }catch(e){ return null; } var result = []; for(var a=0,l=snapshot.snapshotLength; a<l; a++){ result.push(snapshot.snapshotItem(a)); } return result; } function xclass(){ var root, name; switch(arguments.length){ case 1: root = document ; name = arguments[0]; break; case 2: root = arguments[0]; name = arguments[1]; break; default: throw "argument error"; } return selectByXPath(root, '//*[@class="'+ name +'"]'); } //-------------------------------- // for-machine-reading var desc = xclass("description")[0]; // for human-reading var fullDesc = desc.cloneNode(true); fullDesc.setAttribute("class", null); desc.textContent = desc.textContent.substr(0,100); desc.parentNode.insertBefore(fullDesc, desc); desc.style.display = "none"; })();
メイン部分は下の6行だけですね。