angular-easyfb v1.3.0 released!

https://goo.gl/ky60u0

  • 把預設的 ezfb.init() 中的 version 拉到 v2.0
  • 新增 Page plugin 支援

要說今晚為什麼一事無成都是因為在忙這個

原本只是想說把人家發的 PR 處理一下,畢竟那個 PR 延宕已久,之前寫 comment 給發來的人請他改一下他遲遲沒有回應,我只好親自下海修正再 merge 了。

想不到就在 merge 的前後冒出了一個神秘印度人表示他疑似試了並不 work,render 出來的 plugin 寬度不太正常。我試了一下還真如他所說,還好我還沒 push tag 上去。

趕緊查了 Facebook 官方的 Page plugin 頁面,發現這個 plugin 搭配了一個玄妙、不同於以往的莫名奇妙功能叫作 Adaptive Width : https://developers.facebook.com/docs/plugins/page-plugin#adaptive-width

The plugin will automatically adapt to the width of its parent element on page load (min. 180px / max. 500px)

這敘述聽起來是滿美好的… 讓我們繼續看下去

The Page plugin works with responsive, fluid and static layouts. You can use media queries or other methods to set the width of the parent element, yet:

Yet 來了…

  • The plugin will determine its width on page load
  • It will not react changes to the box model after page load

總而言之就是基本上它 adaptive width 的決定性 render 就只有一次,之後還是要靠自己… 然後它就造成我 angular-easyfb 的 directive rendering 發生了神秘的錯誤 Orz

總之由於實作 Angular directive -> Facebook plugin 的對應上我是使用 FB.XFBML.parse ,而它只針對參數的 child element 做 parse,為了不影響到其它的 element,在 parse 前我原本是會先用一個看不到的 <span> 把 plugin 的元素整個包起來。

這個 adaptive width 破壞了這項平衡… 總之現在碰到 adaptive width 的 plugin 我就一律改用 <div> 來包,也索性不加太多隱藏用的 style,畢竟這個 adaptive width 大概是需要去抓 parent element 的寬度的。

好了,總之經過一番千辛萬苦總算修正完成,連 test 部分也一併改好,終於 release 了!

剛剛上面提到恰好出現的神秘印度人一整個就因為剛好碰到我在解這個 issue,他就在線等 XD

Awesome!!! Its working perfectly.. Really thanks a lot for the quick fix..

真的是超級 quick fix wwwww