{"id":18248968,"url":"https://github.com/css-tricks/chat2","last_synced_at":"2025-04-04T15:32:42.310Z","repository":{"id":1097859,"uuid":"957447","full_name":"CSS-Tricks/Chat2","owner":"CSS-Tricks","description":"Chatroom with jQuery, PHP, and text files","archived":false,"fork":false,"pushed_at":"2011-10-06T21:18:09.000Z","size":352,"stargazers_count":54,"open_issues_count":2,"forks_count":24,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-20T15:02:50.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://css-tricks.com/chat2/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CSS-Tricks.png","metadata":{"files":{"readme":"README for Whispering.txt","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-10-02T23:06:56.000Z","updated_at":"2024-04-06T19:55:34.000Z","dependencies_parsed_at":"2022-08-16T12:00:44.304Z","dependency_job_id":null,"html_url":"https://github.com/CSS-Tricks/Chat2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CSS-Tricks%2FChat2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CSS-Tricks%2FChat2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CSS-Tricks%2FChat2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CSS-Tricks%2FChat2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CSS-Tricks","download_url":"https://codeload.github.com/CSS-Tricks/Chat2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247203152,"owners_count":20900926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T09:38:50.232Z","updated_at":"2025-04-04T15:32:37.301Z","avatar_url":"https://github.com/CSS-Tricks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"-----------\nAdd Whispering in Chat v2, by Christian Mehler\n--------------\n\n\nChanges to chat.js: \n\nfunction Chat (filetxt, user) {\nfile = filetxt;\nusernameid = user;\nthis.init = chatInit;\nthis.update = updateChat;\nthis.send = sendChat;\nthis.getState = getStateOfChat;\nthis.trim = trimstr;\nthis.getUsers = getuserlist;\n}\n\nfunction updateChat(){\n\n$.ajax({\n\ntype: \"GET\",\nurl: \"update.php\",\ndata: { \n'state': state,\n'file' : file,\n'nickname': usernameid\n},\ndataType: \"json\",\n...\n\nfunction getuserlist(room, username) {\n\nroomid = room;\nusernameid = username;\n\n$.ajax({\ntype: \"GET\",\nurl: \"userlist.php\",\ndata: { \n'room' : room,\n'username': username,\n'current' : numOfUsers\n\n},\ndataType: \"json\",\ncache: false,\nsuccess: function(data) {\n\nif (numOfUsers != data.numOfUsers) {\nnumOfUsers = data.numOfUsers;\nvar list = \"\n\nCurrent Chatters\n\";\nfor (var i = 0; i \u003c data.userlist.length; i++) { \nlist += '\n'+ data.userlist[i] +\"\n\";\n}\n$('#userlist').html($(\"\n\"+ list +\"\n\"));\n}\n\nsetTimeout('getuserlist(roomid, usernameid)', 1);\n\n},\n});\n\n}\n\nfunction wisper(to)\n{\n$('#sendie').val('@'+to+' '+$('#sendie').val());\n}\n\n\n\n\n\n---------\nChanges to process.php (other saving):\n---------\n\nfwrite(fopen($file, 'a'), $nickname . \"~\\t~\" . $message = str_replace(\"\\n\", \" \", $message) . \"\\n\"); \n\n\n---------\nChanges to update.php\n---------\n\n- at the beginning add\n$nickname = htmlentities(strip_tags($_GET['nickname']), ENT_QUOTES);\n\n\n-later\n...\nif ($state == $count) {\n\n$log['state'] = $state;\n$log['t'] = \"continue\";\n\n} else {\n\n$text= array();\n$log['state'] = $state + getlines(getfile($file)) - $state;\n\nforeach (getfile($file) as $line_num =\u003e $line) {\nif ($line_num \u003e= $state) {\n$line = explode(\"~\\t~\", $line);\nif(substr($line[1], 0, 1)!='@')\n$text[] = ''.$line[0].''.$line[1];\nelseif($line[0]==$nickname || substr($line[1], 0, strlen('@'.$nickname))=='@'.$nickname)\n$text[] = ''.$line[0].' '.$line[1].'';\n}\n\n$log['text'] = $text; \n}\n}\n\necho json_encode($log);\t\n\n?\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcss-tricks%2Fchat2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcss-tricks%2Fchat2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcss-tricks%2Fchat2/lists"}