Planet of NCCUCS
adobe photoshop 8.0 warez Adobe Premiere Pro CS5 can t reinstall adobe creative suite download adobe photoshop 8 0 cs Adobe Illustrator CS5 adobe premiere pro 1.5 serial key adobe acrobat reader 6.0 free Adobe Dreamweaver CS5 adobe course indesign software adobe photoshop free cursive fonts Adobe Photoshop CS5 Extended adobe photoshop elements 4 help sound adobe photoshop logos Adobe Creative Suite 5 Master Collection adobe creative suite torrents adobe photoshop and trial version Adobe Acrobat 9 Pro Extended adobe photoshop shape tools adobe photoshop free trial software Adobe Contribute CS5 wartz adobe acrobat adobe creative suite 2 academic Adobe Indesign CS5 adobe acrobat approval adobe premiere preview download Adobe Flash Catalyst CS5 602 acrobat adobe reader update adobe acrobat 7 reader update Adobe Flex Builder 3 Pro opening pps in adobe photoshop

[wordpress] Google AJAX Libraries API Plugin

作者:TaopaiC on 五月 30, 2008 Posted in RSS | | 觀看文章來源

前幾天 Google 提供幾個知名 javascript 函式庫的hosting, 就想到 wordpress blog 能不能也利用該服務, 好歹可以省掉 jquery (30K) 和 prototype (124K) 的流量, 尤其是放在(暴)慢的主機 ( 如 dreamhoXt … ) 效果非常明顯…
用 google 找到 Google AJAX Libraries API Plugin , 可惜有些問題, 寄修改檔給作者, 希望下一個版本能修正.

==== GEEK 分隔線 ====

該 plugin 沒寫授權方法, 所以我不好意思直接修改放出…
wordpress 用的是加上 jQuery.noConflict() 的 jquery , 而 google 提供的沒有, 以至於直接使用 google 的 jquery 會導致和 prototype 衝突. 我的修改方式是在 jquery script 之後, 再加入一個內容為 jQuery.noConflict() 的 script .

在 usegooglelibrary.php (0.5版本) 加入
function gs_add_jquery_noconflict( $js_array ) {
if ( FALSE !== $jquery = array_search( ‘jquery’, $js_array ) ) {
wp_register_script(’jquery_noconflict’, ‘/wp-content/plugins/j.js’, array(’jquery’), null);
array_splice( $js_array, $jquery+1, 0, ‘jquery_noconflict’ );
}
return $js_array;
}
add_filter(’print_scripts_array’, ‘gs_add_jquery_noconflict’);

以及在 wp-content/plugins 裡新增一個名為 j.js 的檔案, 內容為
jQuery.noConflict();
就會在載入 jquery 之後, 載入 j.js . 且不會和 prototype 衝突. 效果請看筆者 blog 的原始碼. 有錯誤/建議歡迎指教.

:, , , ,

讀過本文的讀者, 也對以下文章有興趣

No comments for this entry yet...

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

最新文章

照片

R0012028R0012036R0013553R0013551R0013550R0013549R0013560R0013558R0013569R0013561R0013570R0013571R0013580R0013581R0013556R0013567R0013563R0013572R0011783R0012312