3 * Ajax Chat for TRPG ver.2.4
4 * (c)2007-2009 Cake All rights reserved.
5 * Mail : cake_67@users.sourceforge.jp
6 * Home : http://trpgtools-onweb.sourceforge.jp/
9 * JaveScriptライブラリ:index.php用
12 require_once './trpgchat-ini.php';
15 <script type="text/javascript">
19 var noname = '<?php print NONAME; ?>';
20 var writescript = './write.php';
21 var pc_num = '<?php print PC_NUM; ?>';
22 var pc_show = '<?php print PC_SHOW_ICON; ?>';
23 var pc_hide = '<?php print PC_HIDE_ICON; ?>';
30 $("#login").click(function(){
33 var name = $("#name_off").attr("value");
34 var pwd = $("#pwd_off").attr("value");
36 if (pwd == undefined) {
40 if (!doLogin(name, pwd)) {
48 document.getElementById("name_on").value = name;
49 document.getElementById("pc_name_0").value = name;
50 document.getElementById("pwd_on").value = pwd;
51 document.getElementById("my_hash").value = "<?php echo create_hash($data['n'],$data['p']); ?>";
52 document.getElementById("pc_input_0").focus();
53 $("#cfchange").hide();
54 if (document.getElementById("cfinput")) {
55 document.getElementById("cfinput").checked = false;
59 window.mainframe.login();
64 $("#logout").click(function(){
65 var name = convert($("#name_on").attr("value"));
74 $("#dice_shortcut").hide();
75 $(".status_column").hide();
76 $("#consumer_rule").hide();
77 $("#consumer_rule_icon").src == '<?php $self_url = get_self_url(); str_replace('./image','image',str_replace('index.php','',$self_url).CONSUMER_RULES_CLOSE_ICON); ?>';
79 $(".show_status").each(function(){
82 $("#whisper").click();
83 document.getElementById("name_on").value = "";
84 document.getElementById("pwd_on").value = "";
85 document.getElementById("my_hash").value = "";
86 $("#name_off").focus();
89 window.mainframe.logout();
98 function cookieWrite() {
99 if (!navigator.cookieEnabled) {
100 alert("クッキーが無効になっています。ブラウザの設定を変更してください。");
104 var CookieName = "<?php print COOKIE;?>";
106 var Expires = (60 * 60 * 24 * 1000 * <?php print COOKEI_EXPIRE; ?>);
107 // どちらかがない場合クッキー使用しない
108 if (!CookieName || !Expires) {
109 alert('チャット側の設定により、クッキー保管機能は無効です。');
114 var COOKIE = "name_off="+$("#name_off").attr("value");
118 for ($i=1;$i<=10;$i++) {
119 print ' if ($("#dice_'.$i.'").attr("value")) {COOKIE += "&dice_'.$i.'="+$("#dice_'.$i.'").attr("value"); }'."\n";
124 if (document.getElementsByName("pc_color_select_0")[0].value+"") { COOKIE += "&pc_color_select_0="+document.getElementsByName("pc_color_select_0")[0].value+"";}
125 if ($("#pc_color_0").attr("value")+"") { COOKIE += "&pc_color_0="+$("#pc_color_0").attr("value")+"";}
126 if ($("#pc_status_0").attr("value")) { COOKIE += "&pc_status_0="+$("#pc_status_0").attr("value"); }
129 for ($i=1; $i<=PC_NUM-1; $i++) {
130 print ' if ($("#pc_name_'.$i.'").attr("value")) {COOKIE += "&pc_name_'.$i.'="+$("#pc_name_'.$i.'").attr("value"); }'."\n";
131 print ' if (document.getElementsByName("pc_color_select_'.$i.'")[0].value+"") { COOKIE += "&pc_color_select_'.$i.'="+document.getElementsByName("pc_color_select_'.$i.'")[0].value+"";}'."\n";
132 print ' if ($("#pc_color_'.$i.'").attr("value")+"") { COOKIE += "&pc_color_'.$i.'="+$("#pc_color_'.$i.'").attr("value")+""; }'."\n";
133 print ' if ($("#pc_status_'.$i.'").attr("value")) { COOKIE += "&pc_status_'.$i.'="+$("#pc_status_'.$i.'").attr("value"); }'."\n";
139 COOKIE += "&fontsize="+window.mainframe.document.getElementById("fontsize").value;
140 COOKIE += "&linespace="+window.mainframe.document.getElementById("linespace").value;
141 COOKIE += "&hr="+window.mainframe.document.getElementById("hr").value;
142 var str = CookieName+"="+encodeURIComponent(COOKIE);
143 domain = location.hostname.replace(/^[^\.]*/, "");
144 str += "; domain="+domain;
145 path = location.pathname.replace("index.php", "");
146 str += "; path="+path;
147 var nowtime = new Date().getTime();
148 expires = new Date(nowtime + Expires);
149 expires = expires.toGMTString();
150 str += "; expires="+expires;
152 document.cookie = str;
154 alert("クッキーを記録しました");
159 function cookieDelete() {
160 if (!navigator.cookieEnabled) {
161 alert("クッキーが無効になっています。ブラウザの設定を変更してください。");
165 var CookieName = "<?php print COOKIE;?>";
167 var Expires = (60 * 60 * 24 * 1000 * <?php print COOKEI_EXPIRE; ?>);
168 // どちらかがない場合クッキー使用しない
169 if (!CookieName || !Expires) {
170 alert('チャット側の設定により、クッキー保管機能は無効です。');
176 var str = CookieName+"="+escape(COOKIE);
177 domain = location.hostname.replace(/^[^\.]*/, "");
178 str += "; domain="+domain;
179 path = location.pathname;
180 str += "; path="+path;
181 str += "; expires=0";
183 document.cookie = str;
185 alert("クッキーを削除しました");