ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Ignore:
Timestamp:
Jan 13, 2008, 12:03:12 AM (13 years ago)
Author:
kudou
Message:

IE対応修正

Location:
OpenPNE/branches/work/cake/pc_emoji
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/work/cake/pc_emoji/pc_emoji_palet.txt

    r4934 r4935  
    5151}
    5252
    53 // 絵文字コードをテキストエリアのカーソル位置に入力
     53// 絵文字コードをテキストエリアに入力
    5454function putEmojiToSelf(emoji) {
    55     var position = document.getElementsByName("body")[0].selectionStart;
    56     var emojiPosition = position + emoji.length;
     55    document.getElementsByName("body")[0].focus();
    5756
    58     var body = document.getElementsByName("body")[0].value.substring(0, position) + emoji + document.getElementsByName("body")[0].value.substring(position, document.getElementsByName("body")[0].value.length);
    59     document.getElementsByName("body")[0].value = body;   
    60     document.getElementsByName("body")[0].focus();
    61     document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     57    // selectionStart対応の場合、選択位置に絵文字挿入
     58    if (document.getElementsByName("body")[0].selectionStart) {
     59        var position = document.getElementsByName("body")[0].selectionStart;
     60        var emojiPosition = position + emoji.length;
     61        var body = document.getElementsByName("body")[0].value.substring(0, position) + emoji + document.getElementsByName("body")[0].value.substring(position, document.getElementsByName("body")[0].value.length);
     62        document.getElementsByName("body")[0].value = body;   
     63        document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     64    } else {
     65        // IEの場合(selection対応)
     66        if (document.selection) {
     67            var sel = document.selection.createRange();
     68            sel.text = emoji;
     69            sel.move('character', emoji.length+4);
     70        } else {
     71            var body = document.getElementsByName("body")[0].value + emoji;
     72            document.getElementsByName("body")[0].value = body;
     73        }
     74    }
    6275}
    6376
  • OpenPNE/branches/work/cake/pc_emoji/pc_emoji_palet_popup_template_all.txt

    r4934 r4935  
    3737// 絵文字コードを親画面のテキストエリアに入力
    3838function putEmojiToParent(emoji) {
    39     var position = opener.document.getElementsByName("body")[0].selectionStart;
    40     var emojiPosition = position + emoji.length;
     39    opener.document.getElementsByName("body")[0].focus();
    4140
    42     var body = opener.document.getElementsByName("body")[0].value.substring(0, position) + emoji + opener.document.getElementsByName("body")[0].value.substring(position, opener.document.getElementsByName("body")[0].value.length);
    43     opener.document.getElementsByName("body")[0].value = body;   
    44     opener.document.getElementsByName("body")[0].focus();
    45     opener.document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     41    // selectionStart対応の場合、選択位置に絵文字挿入
     42    if (opener.document.getElementsByName("body")[0].selectionStart) {
     43        var position = opener.document.getElementsByName("body")[0].selectionStart;
     44        var emojiPosition = position + emoji.length;
     45        var body = opener.document.getElementsByName("body")[0].value.substring(0, position) + emoji + opener.document.getElementsByName("body")[0].value.substring(position, opener.document.getElementsByName("body")[0].value.length);
     46        opener.document.getElementsByName("body")[0].value = body;   
     47        opener.document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     48    } else {
     49        // IEの場合(selection対応)
     50        if (opener.document.selection) {
     51            var sel = opener.document.selection.createRange();
     52            sel.text = emoji;
     53            sel.move('character', emoji.length+4);
     54        } else {
     55            var body = opener.document.getElementsByName("body")[0].value + emoji;
     56            opener.document.getElementsByName("body")[0].value = body;
     57        }
     58    }
    4659}
    4760
  • OpenPNE/branches/work/cake/pc_emoji/pc_emoji_palet_popup_template_au.txt

    r4934 r4935  
    3131// 絵文字コードを親画面のテキストエリアに入力
    3232function putEmojiToParent(emoji) {
    33     var position = opener.document.getElementsByName("body")[0].selectionStart;
    34     var emojiPosition = position + emoji.length;
     33    opener.document.getElementsByName("body")[0].focus();
    3534
    36     var body = opener.document.getElementsByName("body")[0].value.substring(0, position) + emoji + opener.document.getElementsByName("body")[0].value.substring(position, opener.document.getElementsByName("body")[0].value.length);
    37     opener.document.getElementsByName("body")[0].value = body;   
    38     opener.document.getElementsByName("body")[0].focus();
    39     opener.document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     35    // selectionStart対応の場合、選択位置に絵文字挿入
     36    if (opener.document.getElementsByName("body")[0].selectionStart) {
     37        var position = opener.document.getElementsByName("body")[0].selectionStart;
     38        var emojiPosition = position + emoji.length;
     39        var body = opener.document.getElementsByName("body")[0].value.substring(0, position) + emoji + opener.document.getElementsByName("body")[0].value.substring(position, opener.document.getElementsByName("body")[0].value.length);
     40        opener.document.getElementsByName("body")[0].value = body;   
     41        opener.document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     42    } else {
     43        // IEの場合(selection対応)
     44        if (opener.document.selection) {
     45            var sel = opener.document.selection.createRange();
     46            sel.text = emoji;
     47            sel.move('character', emoji.length+4);
     48        } else {
     49            var body = opener.document.getElementsByName("body")[0].value + emoji;
     50            opener.document.getElementsByName("body")[0].value = body;
     51        }
     52    }
    4053}
    4154
  • OpenPNE/branches/work/cake/pc_emoji/pc_emoji_palet_popup_template_docomo.txt

    r4934 r4935  
    3030// 絵文字コードを親画面のテキストエリアに入力
    3131function putEmojiToParent(emoji) {
    32     var position = opener.document.getElementsByName("body")[0].selectionStart;
    33     var emojiPosition = position + emoji.length;
     32    opener.document.getElementsByName("body")[0].focus();
    3433
    35     var body = opener.document.getElementsByName("body")[0].value.substring(0, position) + emoji + opener.document.getElementsByName("body")[0].value.substring(position, opener.document.getElementsByName("body")[0].value.length);
    36     opener.document.getElementsByName("body")[0].value = body;   
    37     opener.document.getElementsByName("body")[0].focus();
    38     opener.document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     34    // selectionStart対応の場合、選択位置に絵文字挿入
     35    if (opener.document.getElementsByName("body")[0].selectionStart) {
     36        var position = opener.document.getElementsByName("body")[0].selectionStart;
     37        var emojiPosition = position + emoji.length;
     38        var body = opener.document.getElementsByName("body")[0].value.substring(0, position) + emoji + opener.document.getElementsByName("body")[0].value.substring(position, opener.document.getElementsByName("body")[0].value.length);
     39        opener.document.getElementsByName("body")[0].value = body;   
     40        opener.document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     41    } else {
     42        // IEの場合(selection対応)
     43        if (opener.document.selection) {
     44            var sel = opener.document.selection.createRange();
     45            sel.text = emoji;
     46            sel.move('character', emoji.length+4);
     47        } else {
     48            var body = opener.document.getElementsByName("body")[0].value + emoji;
     49            opener.document.getElementsByName("body")[0].value = body;
     50        }
     51    }
    3952}
    4053
  • OpenPNE/branches/work/cake/pc_emoji/pc_emoji_palet_popup_template_softbank.txt

    r4934 r4935  
    3030// 絵文字コードを親画面のテキストエリアに入力
    3131function putEmojiToParent(emoji) {
    32     var position = opener.document.getElementsByName("body")[0].selectionStart;
    33     var emojiPosition = position + emoji.length;
     32    opener.document.getElementsByName("body")[0].focus();
    3433
    35     var body = opener.document.getElementsByName("body")[0].value.substring(0, position) + emoji + opener.document.getElementsByName("body")[0].value.substring(position, opener.document.getElementsByName("body")[0].value.length);
    36     opener.document.getElementsByName("body")[0].value = body;   
    37     opener.document.getElementsByName("body")[0].focus();
    38     opener.document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     34    // selectionStart対応の場合、選択位置に絵文字挿入
     35    if (opener.document.getElementsByName("body")[0].selectionStart) {
     36        var position = opener.document.getElementsByName("body")[0].selectionStart;
     37        var emojiPosition = position + emoji.length;
     38        var body = opener.document.getElementsByName("body")[0].value.substring(0, position) + emoji + opener.document.getElementsByName("body")[0].value.substring(position, opener.document.getElementsByName("body")[0].value.length);
     39        opener.document.getElementsByName("body")[0].value = body;   
     40        opener.document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
     41    } else {
     42        // IEの場合(selection対応)
     43        if (opener.document.selection) {
     44            var sel = opener.document.selection.createRange();
     45            sel.text = emoji;
     46            sel.move('character', emoji.length+4);
     47        } else {
     48            var body = opener.document.getElementsByName("body")[0].value + emoji;
     49            opener.document.getElementsByName("body")[0].value = body;
     50        }
     51    }
    3952}
    4053
Note: See TracChangeset for help on using the changeset viewer.