$(document).ready(function () { //禁用文本复制 document.onselectstart = function () { return false; } //禁用鼠标右箭 document.oncontextmenu = function () { return false; } POST = function(name = '地址',json = '数据',result = '回调') { $.post('http://panhua.nat100.top/'+name,json,function(data){ result(data); }) } 滑动显示 = function (table1 = '标签一',time = '时间') { $(table1).css({ overflow:'hidden', cursor:'pointer', }).find('div').css({ width:$(table1).width(), height:$(table1).height(), background:'rgba(44,62,80,.4)', marginTop:$(table1).height()-$(table1).find('span').height(), cursor:'pointer', }).find('*').css({ width:$(table1).width(), color:'#FFF', margin:'5px', textAlign:'left', }); $(table1).hover(function(){ $(this).find('div').animate({ marginTop:'0px', },time) },function(){ $(this).find('div').animate({ marginTop:$(this).height()-$(this).find('span').height(), },time); }); } alert_s = function(value = '类容'){ $('body').append(`
${value}
`); setTimeout(function () { $('#alert').remove(); },500) } //---------------------------------------------------------------------------------------------- if(window.WebSocket){ var ws = new WebSocket(' ws://127.0.0.1:13142'); ws.onopen = function(e){ console.log("连接服务器成功"); ws.send("game2"); } ws.onclose = function(e){ console.log("服务器关闭"); } ws.onerror = function(){ console.log("连接出错"); } ws.onmessage = function(e){ console.log(e.data) $('body').append(``); } } })