Tag Archives: javascript

安裝 Pretty Beautiful Javascript…

Tweet Pretty Beautiful Javascript,這是安裝前看 jQuery 1.7.0 程式碼的效果: 這是安裝後的效果: 不過 javascript 檔案大一點跑起來就會很慢 XD

Posted in Browser, Computer, GoogleChrome, Murmuring, Network, Programming, Software, WWW | Tagged , , , | 2 Comments

改用 jquery-ujs…

Tweet 昨天聽 othree 提到 jquery-ujs (Unobtrusive scripting adapter for jQuery),裡面有不少 convention 可以直接套用。othree 在三月有寫一篇文章介紹:「jQuery-ujs」。 雖然 repository 看起來是給 RoR 使用,但直接把 rails.js 抓下來用「<script src=”rails.js”></script>」掛上來,還是可以用在非 RoR 環境裡。 直接看 code 也很好懂,舉幾個例子來說: <?php $sToken = hash(‘sha256′, session_id()); ?> <meta name=”csrf-token” content=”<?php echo $sToken; ?>”> <meta name=”csrf-param” … Continue reading

Posted in Computer, Murmuring, Network, Programming, Software, WWW | Tagged , , | 1 Comment

jQuery 1.7 版,並計畫瘦身 jQuery…

Tweet jQuery 1.7 前幾天丟出來了,可以看到很多對 event 操作的改善,包括效能與功能 (新增了 .on() 與 .off()):「jQuery 1.7 Released」。 另外今天又看到瘦身計畫:「Building a Slimmer jQuery」,希望把一些「應該要拿掉」或是「應該要被修正」的問題處理掉… 所以在 jQuery 1.7 標為 Deprecation,預定在下個主版本就會處理掉這些問題。 目前 (對我家) 最主要的影響應該是 .live() 會被拔掉,以及之前有使用 .attr(‘value’) 取 current value (要 current value 應該用 .val() 取得)。 看起來是往好的方面進行…

Posted in Browser, Computer, Murmuring, Network, Programming, Software, WWW | Tagged , , , | Leave a comment

Google +1 按鈕的效率問題

Tweet 在「Google +1 Button Performance Review」這篇中,Aaron Peters 對 Google +1 按鈕所提供的方法感到疑惑,因為官方所提供的方法效率其實並不好。 首先先拿出官方的 sample: <!– Place this tag in your head or just before your close body tag –> <script type=”text/javascript” src=”http://apis.google.com/js/plusone.js”></script> <!– Place this tag where you want the +1 … Continue reading

Posted in Browser, Computer, Murmuring, Network, Programming, Software, WWW | Tagged , , , , | 2 Comments

在瀏覽器裡面的「Linux 模擬器」

Tweet QEMU 的作者 Fabrice Bellard 寫了一個 javascript-based 的 x86 emulator:「Javascript PC Emulator」,技術細節在「Javascript PC Emulator – Technical Notes」。 其中實做了 486-based CPU,沒有浮點運算能力,另外因為這是 for fun project,所以很多細節沒做 (Linux 開機沒用到的功能都沒做)。以「x86 instruction listings」這邊列出來的指令集,要做到 486 等級,大約 150 條上下? 真是感謝現在的瀏覽器把 javascript 做的這麼快…

Posted in Browser, Computer, Hardware, Murmuring, Software | Tagged , , , , , , , | Leave a comment

jQuery 1.5.1 釋出

Tweet jQuery 的官方 blog 宣佈 1.5.1 正式出版:「jQuery 1.5.1 Released」,除了 bugfix 外,也宣佈要開 1.6 Roadmap Meeting 討論下一個版本要做的事情,預定在 irc.freenode.net 的 #jquery-meeting 上開,時間是 3/7 (時區是 EST)。 這次 Google CDN 上已經有 1.5.1 版,需要的人可以改過去了…

Posted in CDN, Computer, Murmuring, Network, Software, WWW | Tagged , , , , | Leave a comment

Protocol Preserve URI 的過濾

Tweet 雖然知道 //host.domain/path 這種 Relative Protocol 用法 (而且也用很久了),不過最近在 irc.perl.org 上的 #plack 剛好有人提到,再加上最近剛好有人在探討安全性問題:「Bypassing “RequestPolicy” Using Protocol Relative URLs」,剛好可以拿出來再說一次。 簡單來說就是「以 / 開頭的 URI 並非一定是 same origin,不可以以此當作 same origin 的判斷」。因為「//ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js」這種用法是正確的用法,表示保留 Protocol。 另外講些題外話,這個用法也還是有缺點,用在 IE 的 css 時會造成重複抓取 (到 IE9 都還是):「CSS files downloaded twice in … Continue reading

Posted in Browser, Computer, IE, Murmuring, Network, Security, Software, WWW | Tagged , , , , , , , , , , , | Leave a comment

Mobile Perf bookmarklet

Tweet Mobile Perf bookmarklet 在 Jacky 的 Twitter 上看到的工具,是由 Steve Souders 整理出來的,包括了七個 bookmarklet 工具,執行後就會像這樣: 拿來分析 performance issue 還不錯…

Posted in Browser, Computer, Murmuring, Network, Programming, Software, WWW | Tagged , , | Leave a comment

jQuery 1.5.1 RC 1

Tweet 從 jQuery 1.5.0 出來以後 (2011/1/31) 沒幾天又準備要出 1.5.1 了,剛剛在官方的公告「jQuery 1.5.1 RC 1 Released」上公佈了 1.5.1 RC 1 的連結 (讓人測試),以及大量的 bugfix 資訊… 昨天看了幾個報社的網站,發現不少網站都用 jQuery:(看首頁的部份) 聯合新聞網:1.4.2 (local server) 中時電子報:1.3.2 (Google CDN) 蘋果日報 (台灣):1.4.2 (Google CDN) 而「自由時報電子報」首頁沒有看到 jQuery…

Posted in Computer, Murmuring, Network, Programming, Software | Tagged , , , , | Leave a comment

jQuery CDN failover 的方式…

Tweet 之前有在其他網站上看到 failover 的技巧,但剛剛才發現 jQuery 官方網站上也用上了類似的技巧,將 Google (ajax.googleapis.com) 與 EdgeCast (code.jquery.com) 的 CDN: <script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script> <script>!window.jQuery && document.write(‘<script src=”http://code.jquery.com/jquery-1.4.2.min.js”><\/script>’);</script> 雖然 jQuery 網站上是放在開頭,但放在 HTML 最後面也有一樣的效果…

Posted in CDN, Computer, Murmuring, Network, Programming, Software, WWW | Tagged , , , | 1 Comment