2012年4月26日星期四

[soft] manipulate AJAX elements in jQuery


Recently, I have been looking for a way to manipulate AJAX elements, which are dynamically added to the page. In the best case that the corresponding AJAX event is defined by ourselves, we can simply add a callback function for execution after the AJAX call completion.

But how about the other cases?

jQuery .on() comes to the rescue for most of the cases as you can attach a handler to an existing element then wait for the events of those newly added objects to bubble up to your element. However, not every event bubbles. For instance, 'load' events are filed as simple ones that do not bubble. After doing some Google search, here is what I have got for the solution:
$(selector).on("DOMNodeInserted", function(e){
    var targetElements = $(e.target).find(selector));
    // do something
});
Generally, the idea is that we can attach a handler for the DOMNodeInserted event, then use find() to capture our target AJAX elements from the AJAX call.

Note: This does not works for I.E. with version number <= 8.

2011年2月6日星期日

[nerd] 大年初一閒逛

據說大年初一該出去走走
所以我就出去走一走 然後走了7個小時... XD

是個不錯的天氣

Open將門神


2011年2月3日星期四

[nerd] 花旗聯合勸募活動


超可愛的!!
今年是兔年, 所以捐款的贈品就是兔子~
身為一個屬兔的熱血青年, 當然就支持一下了

[重點]活動官網在此
http://www.unitedway.org.tw/2010citi/
希望有興趣的人也能共襄盛舉囉~

edit:
今天在信義區看到弄成新年打扮的兩隻兔子塑像~ XD

2010年9月30日星期四

[soft] unofficial Google Images instant

unofficial Google Images instant
http://apps.clydeli.com/gi_instant/

a quick app which is apparently inspired by Google Instant

I know someone had done this already
just wanna gave it a try and make it a practice for me

please share the page if you like it
and give bug reports or any comments you'd like to mention
thank you!

2010年9月25日星期六

[soft] 非官方 Google Images instant

非官方 Google Images instant
unofficial Google Image "instant"

這兩天很快寫出來的一個小東西
粗製濫造仿Google Instant寫的 Google圖片即時搜尋
會在使用者輸入時即時搜尋

note:
基本上是直接使用官方API吐給我的資料
設計上設計成要在滑鼠移到圖片上時
圖片下的大小資訊會變成原始網頁資訊
按該連結才會連到原始網頁 否則按圖片會直接連到圖片

-
覺得不錯的話左下角有fb或twitter的分享按鈕可以按~ XD

2010年9月18日星期六

[nerd] 小說 - 告白

我並不是一個喜歡看小說的人
因為小說終歸是虛構的 且大部分都寫得濫情

不過難得有一本小說會想買來看
買來之後 這兩三天也忙裡偷閒的看完了

這本小說是 湊かなえ的「告白」
http://www.books.com.tw/exep/prod/booksfile.php?item=0010445221
-
不過我在訂書前 很犯賤迫不及待的去查了討論
結果踩了一發大雷 讓結局的震撼減少了十倍.. 哭哭

另外我是先看到電影預告才去找小說來看的 電影10/22上映
也很驚訝的發現電影的主題曲是 Radiohead 的 Last Flowers
http://kokuhaku-shimasu.jp/index.html
-
總之小說篇幅不長 但很精采 推薦大家去翻翻看~

2010年8月26日星期四

[void]

前篇

想了想 是說人活著還真靠些對未來的憧憬
當人對未來已經沒有憧憬時 實在沒什麼動力活下去

忽然回顧起來挺符合這兩個案例
有時候找可能的原因也是頗簡單的
但總不要單純的臆測人家的想法與痛苦

anyway, 如果有的話, 願他們的痛苦永遠消失