可以插好多的表單

最近有些 blogger 管理者把留言表單拿掉了,換成彈出視窗,或整頁模式。

這支 bookmarklet 會試著把表單塞回網頁:
自助嵌入 blogger 留言表單


用了沒反應,蛤~怎會這樣?

1)僅在「單篇文章」頁面有用。 2)因各人模板不同,也可能沒效。 3)只支援 Firefox、Google Chrome、Opera 和 Safari 等。

原始碼拆開如下:

  1. var cmt_div = document.getElementById("comments");  
  2. var url, anchor, a = cmt_div.getElementsByTagName("a");  
  3. for( i = 0 ; i < a.length ; i++ ) {  
  4.   if( a[i].hasAttribute("href") && a[i].getAttribute("href").match(/g\?blogID=([0-9]+)\&postID=([0-9]+)/) ) {  
  5.     url = 'http://www.blogger.com/comment-iframe.g?blogID=' + RegExp.$1 + '&postID=' + RegExp.$2;  
  6.     anchor = a[i];  
  7.   }  
  8. }  
  9. cmt_iframe = document.createElement("object");  
  10. cmt_iframe.setAttribute('data', url);  
  11. cmt_iframe.setAttribute('style''display:block; width:100%; height:250px; color:#000; background-color:#f4f1f4; opacity:0.95; padding:0 4px; margin:2px 0; border:2px solid #fff;');  
  12. anchor.parentNode.insertBefore( cmt_iframe, anchor.nextSibling );  
  13. window.scrollTo( cmt_div.offsetLeft, cmt_div.offsetTop );