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

Changeset 6749


Ignore:
Timestamp:
Apr 26, 2008, 7:10:44 PM (11 years ago)
Author:
ebihara
Message:

#2306:テキストモードで「えもぱれ」が使えるようにした

Location:
OpenPNE/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/trunk/public_html/js/pc_emoji_palet/pc_emoji_palet.js

    r5037 r6749  
    3636// 出力
    3737////////
     38function createEmojiPalletDoCoMo()
     39{
     40    document.write('<div id="epDocomo" style="display:none;">');
     41    for (n=1; n<=eNumDocomo; n++) {
     42        emojiPallet(n, "i");
     43    }
     44    document.write('</div>');
     45}
     46
     47function createEmojiPalletAu()
     48{
     49    document.write('<div id="epAu" style="display:none">');
     50    for (n=1; n<=eNumAu1; n++) {
     51        emojiPallet(n, "e");
     52    }
     53    for (n=700; n<=eNumAu2; n++) {
     54        emojiPallet(n, "e");
     55    }
     56    document.write('</div>');
     57}
     58
     59function createEmojiPalletSoftBank()
     60{
     61    document.write('<div id="epSb" style="display:none">');
     62    for (n=1; n<=eNumSb; n++) {
     63        emojiPallet(n, "s");
     64    }
     65    document.write('</div>');
     66}
     67
    3868function output() {
    3969    document.write('<div id="emoji_pallet" class="padding_ss" style="width:439px;">');
     
    4676        if (useSb) document.write(' <a href="#" onclick=\'togglePallet("epSb"); return false;\'>SoftBank</a>');
    4777
    48         // DoCoMo
    49         document.write('<div id="epDocomo" style="display:none;">');
    50         for (n=1; n<=eNumDocomo; n++) {
    51             emojiPallet(n, "i");
     78        createEmojiPalletDoCoMo();
     79
     80        if (useAu) {
     81            createEmojiPalletAu();
    5282        }
    53         document.write('</div>');
    54 
    55         // AU
    56         if (useAu) {
    57             document.write('<div id="epAu" style="display:none">');
    58             for (n=1; n<=eNumAu1; n++) {
    59                 emojiPallet(n, "e");
    60             }
    61             for (n=700; n<=eNumAu2; n++) {
    62                 emojiPallet(n, "e");
    63             }
    64             document.write('</div>');
    65         }
    66         // SoftBank
    6783        if (useSb) {
    68             document.write('<div id="epSb" style="display:none">');
    69             for (n=1; n<=eNumSb; n++) {
    70                 emojiPallet(n, "s");
    71             }
    72             document.write('</div>');
     84            createEmojiPalletSoftBank();
    7385        }
    7486    // 別ウィンドウ版
     
    91103// 絵文字コードをテキストエリアに入力
    92104function putEmojiToSelf(emoji) {
    93     document.getElementsByName("body")[0].focus();
     105    var elm = document.getElementsByName("body")[0];
     106    elm.focus();
    94107
    95     // selectionStart対応の場合、選択位置に絵文字挿入
    96     if (document.getElementsByName("body")[0].selectionStart) {
    97         var position = document.getElementsByName("body")[0].selectionStart;
    98         var emojiPosition = position + emoji.length;
    99         var body = document.getElementsByName("body")[0].value.substring(0, position) + emoji + document.getElementsByName("body")[0].value.substring(position, document.getElementsByName("body")[0].value.length);
    100         document.getElementsByName("body")[0].value = body;   
    101         document.getElementsByName("body")[0].setSelectionRange(emojiPosition, emojiPosition);
    102     } else {
    103         // IEの場合(selection対応)
    104         if (document.selection) {
    105             var sel = document.selection.createRange();
    106             sel.text = emoji;
    107             sel.move('character', emoji.length+4);
    108         // その他の場合は入力済み文章の末尾に絵文字を追加
    109         } else {
    110             var body = document.getElementsByName("body")[0].value + emoji;
    111             document.getElementsByName("body")[0].value = body;
    112         }
    113     }
     108    var selection = new Selection(elm);
     109    var pos = selection.create();
     110
     111    var head = elm.value.substring(0, pos.start);
     112    var tail = elm.value.substring(pos.end, elm.value.length);
     113    elm.value =  head + emoji + tail;
    114114}
    115115
  • OpenPNE/trunk/webapp/modules/pc/templates/h_diary_add.tpl

    r6701 r6749  
    9191
    9292({if $smarty.const.OPENPNE_USE_DECORATION})
     93<script type="text/javascript" src="./js/pc_emoji_palet/pc_emoji_palet.js"></script>
    9394<input type="radio" name="mce_editor_mode_changer" id="mce_editor_mode_changer_1" onclick="pne_toggle_mce_editor('mce_editor_textarea')" checked="checked" /><label for="mce_editor_mode_changer_1">テキストモード</label>&nbsp;<input type="radio" name="mce_editor_mode_changer" id="mce_editor_mode_changer_2" onclick="pne_toggle_mce_editor('mce_editor_textarea')" /><label for="mce_editor_mode_changer_2">プレビューモード</label>
    9495<div id="mce_editor_buttonmenu">
     
    100101({if $smarty.const.OPENPNE_USE_ALBUM})
    101102<a id="mce_textmode_button_op_image" href="#" onclick="window.open('({t_url m=pc a=page_h_album_insert_dialog})', '', 'width=600,height=550,toolbar=no,scrollbars=yes,left=10,top=10')"><img src="({t_img_url_skin filename=deco_op_image})" alt="" /></a>
     103({/if})
     104({if $smarty.const.OPENPNE_EMOJI_DOCOMO_FOR_PC})
     105<a id="mce_textmode_button_op_emoji_docomo" href="#" onclick="togglePallet('epDocomo');"><img src="({t_img_url_skin filename=deco_op_emoji_docomo})" alt="" /></a>
     106<script type="text/javascript">
     107createEmojiPalletDoCoMo();
     108</script>
     109({else})
     110<a id="mce_textmode_button_op_emoji_docomo" href="#" onclick="togglePallet('epDocomo');"><img src="({t_img_url_skin filename=deco_op_emoji_docomo})" alt="" /></a>
     111<a id="mce_textmode_button_op_emoji_au" href="#" onclick="togglePallet('epAu');"><img src="({t_img_url_skin filename=deco_op_emoji_au})" alt="" /></a>
     112<a id="mce_textmode_button_op_emoji_softbank" href="#" onclick="togglePallet('epSb');"><img src="({t_img_url_skin filename=deco_op_emoji_softbank})" alt="" /></a>
     113<script type="text/javascript">
     114createEmojiPalletDoCoMo();
     115createEmojiPalletAu();
     116createEmojiPalletSoftBank();
     117</script>
    102118({/if})
    103119</div>
  • OpenPNE/trunk/webapp/modules/pc/templates/h_diary_edit.tpl

    r6701 r6749  
    9393
    9494({if $smarty.const.OPENPNE_USE_DECORATION})
     95<script type="text/javascript" src="./js/pc_emoji_palet/pc_emoji_palet.js"></script>
    9596<input type="radio" name="mce_editor_mode_changer" id="mce_editor_mode_changer_1" onclick="pne_toggle_mce_editor('mce_editor_textarea')" checked="checked" /><label for="mce_editor_mode_changer_1">テキストモード</label>&nbsp;<input type="radio" name="mce_editor_mode_changer" id="mce_editor_mode_changer_2" onclick="pne_toggle_mce_editor('mce_editor_textarea')" /><label for="mce_editor_mode_changer_2">プレビューモード</label>
    9697
     
    103104({if $smarty.const.OPENPNE_USE_ALBUM})
    104105<a id="mce_textmode_button_op_image" href="#" onclick="window.open('({t_url m=pc a=page_h_album_insert_dialog})', '', 'width=600,height=550,toolbar=no,scrollbars=yes,left=10,top=10')"><img src="({t_img_url_skin filename=deco_op_image})" alt="" /></a>
     106({/if})
     107({if $smarty.const.OPENPNE_EMOJI_DOCOMO_FOR_PC})
     108<a id="mce_textmode_button_op_emoji_docomo" href="#" onclick="togglePallet('epDocomo');"><img src="({t_img_url_skin filename=deco_op_emoji_docomo})" alt="" /></a>
     109<script type="text/javascript">
     110createEmojiPalletDoCoMo();
     111</script>
     112({else})
     113<a id="mce_textmode_button_op_emoji_docomo" href="#" onclick="togglePallet('epDocomo');"><img src="({t_img_url_skin filename=deco_op_emoji_docomo})" alt="" /></a>
     114<a id="mce_textmode_button_op_emoji_au" href="#" onclick="togglePallet('epAu');"><img src="({t_img_url_skin filename=deco_op_emoji_au})" alt="" /></a>
     115<a id="mce_textmode_button_op_emoji_softbank" href="#" onclick="togglePallet('epSb');"><img src="({t_img_url_skin filename=deco_op_emoji_softbank})" alt="" /></a>
     116<script type="text/javascript">
     117createEmojiPalletDoCoMo();
     118createEmojiPalletAu();
     119createEmojiPalletSoftBank();
     120</script>
    105121({/if})
    106122</div>
Note: See TracChangeset for help on using the changeset viewer.