diff --git a/.github/ajax.php b/.github/ajax.php new file mode 100644 index 00000000000..64ea6fca1c4 --- /dev/null +++ b/.github/ajax.php @@ -0,0 +1,83 @@ +count($arr)-1){ + $msg['type'] = 'sys'; + $msg['msg'] = 'rebot'; + $res['list'][] = json_encode($msg); + $res['count'] = $count; + echo json_encode($res); + exit(); + } + //$k = $k==0?$k:$k+1; + if($k<($count-50)){ + $k= $count-50; + } + $arr = array_slice($arr,$k); + array_pop($arr); + $msg['count'] = $count; + $msg['list'] = $arr; + echo json_encode($msg); + break; +} \ No newline at end of file diff --git a/.github/app.php b/.github/app.php new file mode 100644 index 00000000000..b07620415ba --- /dev/null +++ b/.github/app.php @@ -0,0 +1,73 @@ +'.date('Y-m-d H:i').''; + $arr['type']= 'sys'; + $str = json_encode($arr); + $arr['msg'] = '元首提示:'.$name.'加入聊天'; + $arr['type']= 'sys'; + $str = $str."\n".json_encode($arr); + file_put_contents(ROOT_PATH.MSGFILE, $str."\n" , FILE_APPEND|LOCK_EX); + $key = uniqid(); + setcookie(KEYS.'_key',$key,time()+3600*24*90,'/'); + setcookie(KEYS.'_name',urlencode($name),time()+3600*24*30,'/'); + return array('name'=>$name,'key'=>$key); //输出生成的昵称 +} + +function rand_nick(){ + $t=rand(0,199); + $w=rand(0,199); + $name=$name_tou[$t].$name_wei[$w]; + return $name; +} +function logmsg($b, $msg = '成功!') +{ + if ($b > 0) { + $arr['result'] = 200; + $arr['message'] = $msg; + } else { + $arr['result'] = 500; + if (empty($msg)) { + $arr['message'] = '失败!'; + } else { + $arr['message'] = $msg; + } + } + $arr['id'] = $b; + echo json_encode($arr); + exit; +} + + +function get_token(){ + if(empty($_SESSION[KEY.'token'])){ + $token = md5(uniqid(rand(), true)); + $_SESSION[KEY.'token'] = $token; + }else{ + $token = $_SESSION[KEY.'token']; + } + setcookie(md5(KEY.'token'),$token,time()+3600*24,'/'); + return $token; +} + +function check_post($arr,$config=array()){ + $now = time(); + $token = $_COOKIE[md5(KEY.'token')]; + if(empty($token) or $token != $_SESSION[KEY . 'token']){ + return false; + } + return true; +} \ No newline at end of file diff --git a/.github/chat.css b/.github/chat.css new file mode 100644 index 00000000000..70a028c0daa --- /dev/null +++ b/.github/chat.css @@ -0,0 +1,191 @@ +/** + * + * Copyright 2011-2016 mengkunsoft, Inc. + * Licensed under MIT + */ + *, ::before, ::after { + box-sizing: border-box; +} + html,body{ + height: 100%; + margin: 0; + padding: 0; + } +body{ +max-width:800px; +margin:0 auto; + + } +.mk-chat-box{ + font-family: "Helvetica Neue", Helvetica, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; + font-size:16px; + width: 100%; + padding: 0; + position:relative; + overflow-y: scroll; + overflow-x: hidden; + height: calc(100% - 130px);border: 1px solid #eceff1; + border-bottom:0; +} +.top{padding-left:10px;background-color: #eceff1;height:40px;line-height:40px;text-align:center;} +.foot{line-height:50px;text-align:center;font-size:12px;} +.write{height:40px;width: 100%;} +.write input { + font-size: 16px; + float: left; + width: calc(100% - 60px); + height: 40px; + padding: 0 10px; + border-radius:0; + border: 0; + outline: none; + background:#eceff1; + font-family: 'Source Sans Pro', sans-serif; + font-weight: 400; +} +#fresh{color:#fff} +.send{color:#fff;text-decoration:none;width:60px; background-color: #007bff;display:inline-block;height: 40px;line-height:40px;text-align:center} +.send.disabled{background-color: #cccccc;} +.mk-chat-box .msg{ /*Ϣ*/ + margin: 4px 6px; + position: relative; /*IE*/ + min-height: 40px; + border: 0; +} +.mk-chat-box .right{ + text-align: right; + margin-left: 64px; +} +.mk-chat-box .left{ + text-align: left; + margin-right: 64px; +} + +.mk-chat-box img.head{ /*ͷ*/ + width: 32px; + height: 32px; + top: 8px; + position: absolute; + -moz-border-radius: 100%; /* Firefox */ + -webkit-border-radius: 100%; /* Safari Chrome */ + border-radius: 100%; + border: 1px solid #cbe5c8; + -moz-user-select: none; /*ֹûѡ*/ + -o-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.mk-chat-box .right img.head{ + right: 0; +} +.mk-chat-box .left img.head{ + left: 0; +} + +.mk-chat-box .name{ /*dzʾ*/ + color: #8b8b8b; + font-size: 12px; + display: block; + line-height: 18px; +} +.mk-chat-box .right .name{ + margin: 0 48px 2px 0; +} +.mk-chat-box .left .name{ + margin: 0 0 2px 48px; +} + +.mk-chat-box .content{ /*Ϣ*/ + word-break: break-all; + word-wrap: break-word;/*֧IEchromeFF*/ + text-align: left; + position: relative; + display: inline-block; + font-size: 14px; + padding: 6px; + line-height: 18px; + -moz-border-radius: 6px; /* Firefox */ + -webkit-border-radius: 6px; /* Safari Chrome */ + border-radius: 6px; + min-width: 9px; /*ֹֿհϢ*/ + min-height: 18px; +} +.mk-chat-box .content img{ /*ϢͼƬ*/ + width: 100%; + *:width: auto; /*Ͱ汾IE*/ + *:max-width: 100%; + height: auto; +} +.mk-chat-box .content a{ /*Ϣ*/ + color: #0072C1; + margin: 0 5px; + cursor: hand; +} +.mk-chat-box .right .content{ + margin: 0 48px 0 0; + border: 1px solid #78cdf8; + background: #78cdf8; +} +.mk-chat-box .left .content{ + margin: 0 0 0 48px; + border: 1px solid #CDD7E2; + background: #CDD7E2; +} + +.mk-chat-box .content:after{ /*Ϣ*/ + content: ""; + position: absolute; + border-bottom: 8px solid rgba(255, 255, 255, 0); +} +.mk-chat-box .right .content:after{ + right: -12px; + top: 8px; + border-left: 12px solid #78cdf8; +} +.mk-chat-box .left .content:after{ + left: -12px; + top: 8px; + border-right: 12px solid #cdd7e2; +} +.mk-chat-box .tips{ /*ϵͳʾ*/ + margin: 12px; + text-align: center; + font-size: 12px; +} +.mk-chat-box .tips span{ + display: inline-block; + padding: 4px; + background-color: #cccccc; + color: #ffffff; + -moz-border-radius: 6px; /* Firefox */ + -webkit-border-radius: 6px; /* Safari Chrome */ + border-radius: 6px; +} +.mk-chat-box .tips .tips-primary{ + background-color: #428bca; +} +.mk-chat-box .tips .tips-success{ + background-color: #5cb85c; +} +.mk-chat-box .tips .tips-info{ + background-color: #5bc0de; +} +.mk-chat-box .tips .tips-warning{ + background-color: #f0ad4e; +} +.mk-chat-box .tips .tips-danger{ + background-color: #d9534f; +} + +/**/ +.mk-chat-box::-webkit-scrollbar{width:8px;height:8px} +.mk-chat-box::-webkit-scrollbar-button:vertical{display:none} +.mk-chat-box::-webkit-scrollbar-track:vertical{background-color:transparent;} +.mk-chat-box::-webkit-scrollbar-track-piece{background-color:transparent;} +.mk-chat-box::-webkit-scrollbar-thumb:vertical{background-color:rgba(204,204,204,.3);border-radius:8px} +.mk-chat-box::-webkit-scrollbar-thumb:vertical:hover, +.mk-chat-box::-webkit-scrollbar-thumb:vertical:active {background-color: #8C8C8C} +.login{margin-top:10px;} \ No newline at end of file diff --git a/.github/chat.min.js b/.github/chat.min.js new file mode 100644 index 00000000000..a20ddcf6162 --- /dev/null +++ b/.github/chat.min.js @@ -0,0 +1,126 @@ +var k = 0, + c = "", + n = 0, + name = "", + key = "", + t = 0; + +function sockll() { + $(".mk-chat-box").scrollTop($(".mk-chat-box")[0].scrollHeight) +} +var send_btn = !0; + +function send() { + if ($("#send").hasClass("disabled")) return addtip("\u53d1\u8a00\u592a\u5feb\uff0c\u95f4\u9694\u4e3a3\u79d2\uff01", "tips-info"), !1; + var a = $("#msg").val(); + if (1 > a.length) return !1; + 0 == k && (t = 1); + $("#send").addClass("disabled"); + $.post("app/ajax.php?c=send", { + msg: a + }, function(a) { + $("#msg").val(""); + addmsg(a.name, a.msg, "right"); + setTimeout(function() { + $("#send").removeClass("disabled") + }, 3E3); + window.clearInterval(c); + n = 0; + c = setInterval(function() { + get_msg() + }, 1E3) + }, "json") +} +function addtip(a, b) { + $(".mk-chat-box").append('