Search

2/26/2009

YAHOO.util.Get.autopurge


// autopurge, bool, If true, script nodes will automatically be removed every 20
// transactions (configurable via YAHOO.util.Get.PURGE_THRESH property.
// Default: true for script nodes, false for CSS nodes.
YAHOO.util.Get.PURGE_THRESH = 5;
YAHOO.util.Get.script(aURLs, {
onSuccess: successHandler,
autopurge: true
});

2/25/2009

YAHOO.util.Event with extra arguments


var test = function(){
console.log(arguments[1].hello);
}
YAHOO.util.Event.on(window, 'load', test, {hello:'world'})


var test = function(e, args){
console.log(args.hello);
}
YAHOO.util.Event.on(window, 'load', test, {hello:'world'})

What's New in Internet Explorer 8

What's New in Internet Explorer 8

AJAX Enhancements
* AJAX Navigation — Client requests that do not trigger traditional Web page navigation can now update the hash property, which allows the Back button to function appropriately.
* Connection Events — Where data reliability is a priority, AJAX applications can choose to save data locally if they are disconnected from a network. See onoffline, ononline.
* Cross-document Messaging — Documents in different domains can securely exchange data using postMessage. Documents that receive messages listen for the onmessage event.
CSS Compliance
* Table Layout — For many years, tables were the preferred layout mechanism on the Internet. With Internet Explorer 8, it is now possible to apply table-style formatting to non-table elements using the display attribute. In practice, CSS tables are more permissive than HTML markup; tables created with CSS rules will nest elements to become valid, whereas tables created with HTML will close containers to avoid unexpected nesting.
* Data URI — This mechanism allows a Web page author to embed small entities directly within a Uniform Resource Identifier (URI), rather than using the URI to identify a location from which to retrieve the entity. This is primarily of interest for small images (such as bullets) used within CSS or layout. See data Protocol for an example.
* Generated Content — Web page authors can render content that does not come from the document tree:
* :before and :after — In conjunction with the new content rule, authors can describe dynamic content to appear before and after most elements.
* counter-reset and counter-increment — Automatically insert numbers into your document.
* Internet Explorer 8 Beta 2. quotes — Easily insert language-dependent quote characters or smart quotes.

* outline — Enables elements to be highlighted without affecting their size. The outline is a shorthand property for outline-color, outline-style, and outline-width.

IEBlog : Introducing IE=EmulateIE7

IE8 的 相容Quirks模式 Meta Tag(X-UA-Compatible) | Tsung's Blog
<meta http-equiv="X-UA-Compatible" content="IE=7" >
* IE=5: "Quirks" mode
* IE=7: "Standards" mode
* IE=8: Internet Explorer 8 Standards mode
* IE=edge: Uses latest standards that Internet Explorer 8 and any future versions of the browser support. Not recommended for production sites.

spacer.gif

used in flicker
http://l.yimg.com/g/images/spaceout.gif

2/24/2009

系統安裝細節

1. mplayer 遇到簡體或日文片假名無法播放, 安裝 unicode 補完計畫可解
2. intel g43 在 winxp 下字體會模糊, 重新整理速率調成 72hz or 75hz 可解

to read

Ajaxian » Bespin: A new Mozilla Labs experimental extensible code editor using Canvas
Ajaxian » Designing a JavaScript client for a REST API
Ajaxian » Prefilling forms with Microformats and YQL

Mozilla Webdev » Blog Archive » Cross-Browser Inline-Block

Mozilla Webdev » Blog Archive » Cross-Browser Inline-Block

What’s going on here is the baseline of each <li> is being aligned with the baseline of the parent <ul>. Putting it as simply as possible, the default vertical-align value on inline or inline-block element is baseline, which means the element’s baseline will be aligned with its parent’s baseline.

Technically, what hasLayout means is an element with hasLayout set to true is responsible for rendering itself and its children (combine that with a min-height and width, and you get something very similar to display:block). It’s kinda like magical fairy dust you can sprinkle on rendering issues and make them disappear.

When we add zoom:1 and *display:inline (star hack to target IE6 & 7) to the
  • s, we make IE 7 display them as if they were inline-block:

  • CSS2 - The display declaration - ie 要模擬成 display: inline-block, 必須同時加上 zoom:1 以及 display:inline
    In IE 6 and 7 inline-block works only on elements that have a natural display: inline.





    <li>
    <div>
    <h4>This is awesome</h4>
    <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg"
    alt="lobster" width="75" height="75"/>
    <</div>
    </li>

    Stack Positioning - MDC

    board game

    game
    * Puerto Rico

    http://www.hnl.com.tw/bbs/redirect.php?tid=497&goto=lastpost
    全省桌上遊戲教玩場所
    1. 女巫店──http://www.witchhouse.org/,地址:台北市新生南路三段56巷7號1F,電話:02-23625494。是主要的德式
      桌上遊戲經銷點,週末還有人現場教新手玩遊戲。
    2. 艾客米──http://www.akmigames.com/,地址:台北市忠孝東路三段305號9F-1,電話:02-27419964。桌上遊戲專門
      店,定期舉辦討論會等活動,除了德式桌上遊戲之外,還有美國等其他國家的桌上遊戲。
    3. STYLE餐廳──地址:台北市泰順街50巷36號,電話:02-23682372,師大附近的日式餐廳,兩位年輕老闆可以教你
      玩遊戲。
    4. 台北DOUBLE COFFEE──地址:台北市長安西路138巷3弄2號,電話:02-25490610,台北車站附近的遊戲咖啡
      館。
    5. 台中柳雲茶軒──地址:台中市育德街50號,電話:0931-676313 找「丸子」,中部的遊戲集會場所。
    6. 魚麗人文主題書店──地址:台中市西區民權路117巷1號,電話:04-22257941,書店與咖啡館結合的桌上遊戲場所
    7. 高雄豆皮文藝咖啡館──地址:高雄市五福四路131號2F,電話:07-5212422,南部藝術家最愛的藝文空間,唯一的
      桌上遊戲咖啡館。

    布袋鮮の蚵

    Vivian的美食樂園 - 布袋鮮之蚵

    ***布袋鮮之蚵
    台北市和平西路三段198號 (近華江橋)
    (02)2308-3463
    11:00--20:30 週日休
    (有時生意太好 , 晚上6點多食材就通通賣完了 , 所以不建議太晚到喔)

    2/19/2009

    Developer's Guide - AJAX Libraries API - Google Code

    Yahoo! User Interface Library (YUI)
    name: yui
    versions: 2.6.0
    load request: load request: google.load("yui", "2.6.0");
    extras: uncompressed:true, e.g., google.load("yui", "2.6.0", {uncompressed:true});
    path: http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/yuiloader/yuiloader-min.js
    path(u): http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/yuiloader/yuiloader.js
    site: http://developer.yahoo.com/yui/

    2/18/2009

    charAt

    要拿 array[index] 的值, 在 ie 下要用 charAt(index).


    var str = 'hello world';
    alert(str[0]); // IE fail, FF ok
    alert(str.charAt(0)); // IE ok, FF ok

    2/16/2009

    YUI Panel factory

    http://chunghe.googlecode.com/svn/trunk/project/panel.factory/index.htm
    panel proerties: panel.body, panel.element, panel.footer, panel.header, panel.id
    panel methods: bringToTop, focusFirst, focusLast, appendToBody, appendToFooter, appendToHeader, render, setBody, setHeader, setFooter, show


    // pass the optional cfg to overwrite the default cfg
    var Factory = function(id, args) {
    var panel;
    var cfg = {
    width: '600px',
    fixedcenter: true,
    modal: true,
    visible: false
    };

    var args = args || {};
    cfg = YAHOO.lang.merge(cfg, args);

    panel = new YAHOO.widget.Panel(id, cfg);

    var keyEsc = new YAHOO.util.KeyListener( document, {keys:27},
    {
    fn: panel.hide,
    scope: panel,
    correctScope: true
    });
    keyEsc.enable();

    return panel;
    };
    /*
    * For Modules without existing markup, the appendToNode argument
    * is REQUIRED. If this argument is ommitted and the current element is
    * not present in the document, the function will return false,
    * indicating that the render was a failure.
    */

    /* 0. rendering the existing HTML */
    var panel0 = Factory('myPanel');
    panel0.render();
    panel0.show();


    /* 1. configure options by pass in the configure object */
    var panel1 = Factory('panel1', {'width' : '300px'});
    panel1.setBody('panel1');
    panel1.render(document.body);
    //panel1.show();

    /* 2. configure options via queueProperty, prior to rendering */
    var panel2 = Factory('panel2');
    panel2.cfg.queueProperty('width', '300px');
    panel2.setBody('panel2');
    panel2.render(document.body);
    //panel2.show();

    /* 3. configure options via setProperty, after rendering */
    var panel3 = Factory('panel3');
    panel3.setBody('panel3');
    panel3.render(document.body);
    panel3.cfg.setProperty('width', '300px');
    //panel3.show();

    /* modify the content after rendering : render again ! */
    var panel4 = Factory('panel4');
    //panel4.render(document.body);
    panel4.setHeader('header');
    panel4.setBody('Panel4');
    panel4.render();
    // panel4.show();

    /* modify the content by appendToChild */
    var headerText = document.createTextNode('panel5 header');
    var bodyText = document.createTextNode('panel5 body');

    var panel5 = Factory('panel5');
    panel5.render(document.body);
    panel5.appendToHeader(headerText);
    panel5.appendToBody(bodyText);
    panel5.render();
    // panel5.show();


    /* set dummy head/body/ft and modify after rendering */
    var panel6 = Factory('panel6');
    panel6.setBody('');
    panel6.render(document.body)
    panel6.setBody('hello world');
    panel6.show();

    2/11/2009

    YUI tabview : get active index when change

    // from cheetsheet
    var tab = new YAHOO.widget.TabView('some-tab');
    tab.addListener('activeTabChange', function(o){
    var index = this.getTabIndex(o.newValue);
    console.log(index);
    })


    var tabInit = function() {
    var archiveTab = new YAHOO.widget.TabView('archive-tab');
    var match = window.location.href.match(/type=([^&#]*)/);
    var type = match ? match[1] : 'blog';

    archiveTab.set('activeIndex',
    YAHOO.lang.substitute('{' + type + '}', {
    'blog':0, 'album':1, 'video':2
    })
    );

    archiveTab.on('activeTabChange', function(o){
    window.location.type = o.newValue.getElementsByTagName('a')[0].type;
    });

    }; // tabInit

    2/09/2009

    ||: default operator


    >>> YAHOO
    ReferenceError: YAHOO is not defined source=with(_FirebugCommandLine){YAHOO\n};
    >>> YAHOO = YAHOO || {}
    ReferenceError: YAHOO is not defined
    >>> YAHOO = {}
    Object
    >>> YAHOO.foo = YAHOO.foo || {}
    Object

    要 initial YAHOO 只能用

    if(typeof YAHOO == 'undefined' || !YAHOO){
    var YAHOO = {};
    }

    要 initial YAHOO 裡面的 property 可以用比較快的方法

    YAHOO.foo = YAHOO.foo || {}