id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
xhan/qqbot:src/qqapi.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
req = http.request options, (resp) ->
log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
ret = JSON.parse(body)
callback( ret )
long_poll(client_id ... | var req;
req = http.request(options, function(resp) {
log(`response: ${resp.statusCode}`);
resp.on('data', function(chunk) {
return body += chunk;
});
return resp.on('end', function() {
var ret;
ret = JSON.parse(body);
callback(ret);
return long_poll(client_id, psessionid, callback);
});
... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07 | 1,435 | https://github.com/xhan/qqbot/blob/d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07/src/qqapi.coffee | 51 | 63 |
xhan/qqbot:src/qqapi.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var req;
req = http.request(options, function(resp) {
log(`response: ${resp.statusCode}`);
resp.on('data', function(chunk) {
return body += chunk;
});
return resp.on('end', function() {
var ret;
ret = JSON.parse(body);
callback(ret);
re... | req = http.request options, (resp) ->
log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
ret = JSON.parse(body)
callback( ret )
long_poll(client_id , psessionid , callback)
req.write(data);
req.end... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07 | 1,435 | https://github.com/xhan/qqbot/blob/d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07/src/qqapi.coffee | 51 | 63 |
xhan/qqbot:src/qqapi.coffee:2:completion | completion | req = http.request options, (resp) ->
log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
ret = JSON.parse(body) | callback( ret )
long_poll(client_id , psessionid , callback)
req.write(data);
req.end();
exports.long_poll = long_poll | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07 | 1,435 | https://github.com/xhan/qqbot/blob/d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07/src/qqapi.coffee | 51 | 63 |
xhan/qqbot:src/qqapi.coffee:1:raw_corpus | raw_corpus | https = require "https"
http = require 'http'
crypto = require 'crypto'
querystring = require 'querystring'
Url = require('url')
all_cookies = []
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | a3b2188eea9ffeddfa60644f52f4ad28d9213462 | 1,435 | https://github.com/xhan/qqbot/blob/a3b2188eea9ffeddfa60644f52f4ad28d9213462/src/qqapi.coffee | 1 | 13 | ||
xhan/qqbot:src/qqapi.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
https = require "https"
http = require 'http'
crypto = require 'crypto'
querystring = require 'querystring'
Url = require('url')
all_cookies = []
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log ... | var Url, all_cookies, crypto, http, https, log, md5, querystring;
https = require("https");
http = require('http');
crypto = require('crypto');
querystring = require('querystring');
Url = require('url');
all_cookies = [];
md5 = function(str) {
var md5sum;
md5sum = crypto.createHash('md5');
return md5sum.up... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | a3b2188eea9ffeddfa60644f52f4ad28d9213462 | 1,435 | https://github.com/xhan/qqbot/blob/a3b2188eea9ffeddfa60644f52f4ad28d9213462/src/qqapi.coffee | 1 | 13 |
xhan/qqbot:src/qqapi.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Url, all_cookies, crypto, http, https, log, md5, querystring;
https = require("https");
http = require('http');
crypto = require('crypto');
querystring = require('querystring');
Url = require('url');
all_cookies = [];
md5 = function(str) {
var md5sum;
... | https = require "https"
http = require 'http'
crypto = require 'crypto'
querystring = require 'querystring'
Url = require('url')
all_cookies = []
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | a3b2188eea9ffeddfa60644f52f4ad28d9213462 | 1,435 | https://github.com/xhan/qqbot/blob/a3b2188eea9ffeddfa60644f52f4ad28d9213462/src/qqapi.coffee | 1 | 13 |
xhan/qqbot:src/qqapi.coffee:1:completion | completion | https = require "https"
http = require 'http'
crypto = require 'crypto'
querystring = require 'querystring'
Url = require('url')
all_cookies = [] | md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | a3b2188eea9ffeddfa60644f52f4ad28d9213462 | 1,435 | https://github.com/xhan/qqbot/blob/a3b2188eea9ffeddfa60644f52f4ad28d9213462/src/qqapi.coffee | 1 | 13 |
xhan/qqbot:src/qqapi.coffee:1:raw_corpus | raw_corpus | md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
# 是否需要 验证码
# @param qq
# @param callback -> [是否需要验证码 , token , bits ] | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 8 | 17 | ||
xhan/qqbot:src/qqapi.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
# 是否需要 验证码
# @param qq
# @param callback -> [是否需要验证码 , token , bits ]
``` | var log, md5;
md5 = function(str) {
var md5sum;
md5sum = crypto.createHash('md5');
return md5sum.update(str).digest('hex');
};
// TODO: logger 分级控制
log = console.log;
// 是否需要 验证码
// @param qq
// @param callback -> [是否需要验证码 , token , bits ] | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 8 | 17 |
xhan/qqbot:src/qqapi.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var log, md5;
md5 = function(str) {
var md5sum;
md5sum = crypto.createHash('md5');
return md5sum.update(str).digest('hex');
};
// TODO: logger 分级控制
log = console.log;
// 是否需要 验证码
// @param qq
// @param callback -> [是否需要验证码 , token , bits ]
``` | md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
# 是否需要 验证码
# @param qq
# @param callback -> [是否需要验证码 , token , bits ] | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 8 | 17 |
xhan/qqbot:src/qqapi.coffee:1:completion | completion | md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制 | log = console.log
# 是否需要 验证码
# @param qq
# @param callback -> [是否需要验证码 , token , bits ] | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 8 | 17 |
xhan/qqbot:src/qqapi.coffee:2:raw_corpus | raw_corpus | exports.check_qq = (qq, callback) ->
# TODO: random -> r
options =
host: 'ssl.ptlogin2.qq.com'
path: "/check?uin=#{qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522"
headers:
'Cookie' : "chkuin=#{qq}"
body = '';
https
.get options , (resp) ->
... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 18 | 46 | ||
xhan/qqbot:src/qqapi.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.check_qq = (qq, callback) ->
# TODO: random -> r
options =
host: 'ssl.ptlogin2.qq.com'
path: "/check?uin=#{qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522"
headers:
'Cookie' : "chkuin=#{qq}"
... | exports.check_qq = function(qq, callback) {
var body, options;
// TODO: random -> r
options = {
host: 'ssl.ptlogin2.qq.com',
path: `/check?uin=${qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522`,
headers: {
'Cookie': `chkuin=${qq}`
}
};
body = '';
return https.get(options,... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 18 | 46 |
xhan/qqbot:src/qqapi.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.check_qq = function(qq, callback) {
var body, options;
// TODO: random -> r
options = {
host: 'ssl.ptlogin2.qq.com',
path: `/check?uin=${qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522`,
headers: {
'Cookie': `chkuin=${q... | exports.check_qq = (qq, callback) ->
# TODO: random -> r
options =
host: 'ssl.ptlogin2.qq.com'
path: "/check?uin=#{qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522"
headers:
'Cookie' : "chkuin=#{qq}"
body = '';
https
.get options , (resp) ->
... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 18 | 46 |
xhan/qqbot:src/qqapi.coffee:2:completion | completion | exports.check_qq = (qq, callback) ->
# TODO: random -> r
options =
host: 'ssl.ptlogin2.qq.com'
path: "/check?uin=#{qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522"
headers:
'Cookie' : "chkuin=#{qq}"
body = '';
https
.get options , (resp) ->
... | resp.on 'data', (chunk) ->
body += chunk;
resp.on 'end', ->
# log body
ret = body.match(/\'(.*?)\'/g).map (i)->
last = i.length - 2
i.substr(1 ,last)
# log ret
callback( ret )
.on... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 18 | 46 |
xhan/qqbot:src/qqapi.coffee:3:raw_corpus | raw_corpus | exports.get_verify_code_url = (qq) ->
"https://ssl.captcha.qq.com/getimage?aid=1003903&r=0.2509327069195215&uin=#{qq}"
# 生成加密密码
# @param password 密码
# @param token check_qq 参数1 !UGX
# @param bits check_qq 参数2 \x00\x11\x00\x11 | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 47 | 55 | ||
xhan/qqbot:src/qqapi.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.get_verify_code_url = (qq) ->
"https://ssl.captcha.qq.com/getimage?aid=1003903&r=0.2509327069195215&uin=#{qq}"
# 生成加密密码
# @param password 密码
# @param token check_qq 参数1 !UGX
# @param bits check_qq 参数2 \x00\x11\x00\x11
``` | exports.get_verify_code_url = function(qq) {
return `https://ssl.captcha.qq.com/getimage?aid=1003903&r=0.2509327069195215&uin=${qq}`;
};
// 生成加密密码
// @param password 密码
// @param token check_qq 参数1 !UGX
// @param bits check_qq 参数2 \x00\x11\x00\x11 | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 47 | 55 |
xhan/qqbot:src/qqapi.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.get_verify_code_url = function(qq) {
return `https://ssl.captcha.qq.com/getimage?aid=1003903&r=0.2509327069195215&uin=${qq}`;
};
// 生成加密密码
// @param password 密码
// @param token check_qq 参数1 !UGX
// @param bits check_qq 参数2 \x00\x11\x00\x11
``` | exports.get_verify_code_url = (qq) ->
"https://ssl.captcha.qq.com/getimage?aid=1003903&r=0.2509327069195215&uin=#{qq}"
# 生成加密密码
# @param password 密码
# @param token check_qq 参数1 !UGX
# @param bits check_qq 参数2 \x00\x11\x00\x11 | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 47 | 55 |
xhan/qqbot:src/qqapi.coffee:4:raw_corpus | raw_corpus | exports.encode_password = (password , token , bits) ->
password = md5(password)
bits = bits.replace(/\\x/g,'')
hex2ascii = (hexstr) ->
hexstr.match(/\w{2}/g)
.map (byte_str) ->
String.fromCharCode parseInt(byte_str,16)
.join('')
ret = md5( hex2asc... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 56 | 73 | ||
xhan/qqbot:src/qqapi.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.encode_password = (password , token , bits) ->
password = md5(password)
bits = bits.replace(/\\x/g,'')
hex2ascii = (hexstr) ->
hexstr.match(/\w{2}/g)
.map (byte_str) ->
String.fromCharCode parseInt(byt... | exports.encode_password = function(password, token, bits) {
var hex2ascii, ret;
password = md5(password);
bits = bits.replace(/\\x/g, '');
hex2ascii = function(hexstr) {
return hexstr.match(/\w{2}/g).map(function(byte_str) {
return String.fromCharCode(parseInt(byte_str, 16));
}).join('');
};
r... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 56 | 73 |
xhan/qqbot:src/qqapi.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.encode_password = function(password, token, bits) {
var hex2ascii, ret;
password = md5(password);
bits = bits.replace(/\\x/g, '');
hex2ascii = function(hexstr) {
return hexstr.match(/\w{2}/g).map(function(byte_str) {
return String.fromChar... | exports.encode_password = (password , token , bits) ->
password = md5(password)
bits = bits.replace(/\\x/g,'')
hex2ascii = (hexstr) ->
hexstr.match(/\w{2}/g)
.map (byte_str) ->
String.fromCharCode parseInt(byte_str,16)
.join('')
ret = md5( hex2asc... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 56 | 73 |
xhan/qqbot:src/qqapi.coffee:4:completion | completion | exports.encode_password = (password , token , bits) ->
password = md5(password)
bits = bits.replace(/\\x/g,'')
hex2ascii = (hexstr) ->
hexstr.match(/\w{2}/g)
.map (byte_str) ->
String.fromCharCode parseInt(byte_str,16) | .join('')
ret = md5( hex2ascii(password) + hex2ascii(bits) ).toUpperCase() + token
ret = md5( ret ).toUpperCase()
return ret
# 登录 帐号密码验证码 校验 | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 56 | 73 |
xhan/qqbot:src/qqapi.coffee:5:raw_corpus | raw_corpus | exports.login = (qq, encode_password, verifycode, cookies , callback) ->
path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb2.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&h=1&ptredirect=0&ptlang=2052&daid=164&from_... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 74 | 102 | ||
xhan/qqbot:src/qqapi.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.login = (qq, encode_password, verifycode, cookies , callback) ->
path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb2.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26we... | exports.login = function(qq, encode_password, verifycode, cookies, callback) {
var body, options, path;
path = `/login?u=${qq}&p=${encode_password}&verifycode=${verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb2.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&h=1&ptredire... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 74 | 102 |
xhan/qqbot:src/qqapi.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.login = function(qq, encode_password, verifycode, cookies, callback) {
var body, options, path;
path = `/login?u=${qq}&p=${encode_password}&verifycode=${verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb2.qq.com%2Floginp... | exports.login = (qq, encode_password, verifycode, cookies , callback) ->
path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb2.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&h=1&ptredirect=0&ptlang=2052&daid=164&from_... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 74 | 102 |
xhan/qqbot:src/qqapi.coffee:5:completion | completion | exports.login = (qq, encode_password, verifycode, cookies , callback) ->
path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb2.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&h=1&ptredirect=0&ptlang=2052&daid=164&from_... | log all_cookies
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
ret = body.match(/\'(.*?)\'/g).map (i)->
last = i.length - 2
i.substr(1 ,last)
callback( ret )
.on "error", (e) ->
... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 74 | 102 |
xhan/qqbot:src/qqapi.coffee:6:raw_corpus | raw_corpus | exports.login_token = (callback) ->
client_id = parseInt(Math.random() * 100000000)
ptwebqq = all_cookies.filter( (item)->item.match /ptwebqq/ )
.pop()
.replace /ptwebqq\=(.*?);.*/ , '$1'
# log all_cookies
r =
status: "online",
ptw... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 104 | 149 | ||
xhan/qqbot:src/qqapi.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.login_token = (callback) ->
client_id = parseInt(Math.random() * 100000000)
ptwebqq = all_cookies.filter( (item)->item.match /ptwebqq/ )
.pop()
.replace /ptwebqq\=(.*?);.*/ , '$1'
# log ... | exports.login_token = function(callback) {
var body, client_id, data, options, ptwebqq, r, req;
client_id = parseInt(Math.random() * 100000000);
ptwebqq = all_cookies.filter(function(item) {
return item.match(/ptwebqq/);
}).pop().replace(/ptwebqq\=(.*?);.*/, '$1');
// log all_cookies
r = {
status: "... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 104 | 149 |
xhan/qqbot:src/qqapi.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.login_token = function(callback) {
var body, client_id, data, options, ptwebqq, r, req;
client_id = parseInt(Math.random() * 100000000);
ptwebqq = all_cookies.filter(function(item) {
return item.match(/ptwebqq/);
}).pop().replace(/ptwebqq\=(.*?)... | exports.login_token = (callback) ->
client_id = parseInt(Math.random() * 100000000)
ptwebqq = all_cookies.filter( (item)->item.match /ptwebqq/ )
.pop()
.replace /ptwebqq\=(.*?);.*/ , '$1'
# log all_cookies
r =
status: "online",
ptw... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 104 | 149 |
xhan/qqbot:src/qqapi.coffee:6:completion | completion | exports.login_token = (callback) ->
client_id = parseInt(Math.random() * 100000000)
ptwebqq = all_cookies.filter( (item)->item.match /ptwebqq/ )
.pop()
.replace /ptwebqq\=(.*?);.*/ , '$1'
# log all_cookies
r =
status: "online",
ptw... | options =
host: 'd.web2.qq.com',
path: '/channel/login2',
method: 'POST',
headers:
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0',
'Referer': 'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3',
... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 104 | 149 |
xhan/qqbot:src/qqapi.coffee:7:raw_corpus | raw_corpus | exports.login_step2 = (url, callback) ->
url = Url.parse(url)
options =
host: url.host
path: url.path
headers:
'Cookie' : all_cookies
body = '';
http
.get options , (resp) ->
log "response: #{resp.statusCode}"
all_cookies = all_cookie... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 150 | 166 | ||
xhan/qqbot:src/qqapi.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.login_step2 = (url, callback) ->
url = Url.parse(url)
options =
host: url.host
path: url.path
headers:
'Cookie' : all_cookies
body = '';
http
.get options , (resp) ->
log "response:... | exports.login_step2 = function(url, callback) {
var body, options;
url = Url.parse(url);
options = {
host: url.host,
path: url.path,
headers: {
'Cookie': all_cookies
}
};
body = '';
return http.get(options, function(resp) {
var all_cookies;
log(`response: ${resp.statusCode}`);
... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 150 | 166 |
xhan/qqbot:src/qqapi.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.login_step2 = function(url, callback) {
var body, options;
url = Url.parse(url);
options = {
host: url.host,
path: url.path,
headers: {
'Cookie': all_cookies
}
};
body = '';
return http.get(options, function(resp) {
var... | exports.login_step2 = (url, callback) ->
url = Url.parse(url)
options =
host: url.host
path: url.path
headers:
'Cookie' : all_cookies
body = '';
http
.get options , (resp) ->
log "response: #{resp.statusCode}"
all_cookies = all_cookie... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 150 | 166 |
xhan/qqbot:src/qqapi.coffee:7:completion | completion | exports.login_step2 = (url, callback) ->
url = Url.parse(url)
options =
host: url.host
path: url.path
headers:
'Cookie' : all_cookies | body = '';
http
.get options , (resp) ->
log "response: #{resp.statusCode}"
all_cookies = all_cookies.concat resp.headers['set-cookie']
callback( true )
# 只需要获取cookie
.on "error", (e) ->
log e | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 150 | 166 |
xhan/qqbot:src/qqapi.coffee:8:raw_corpus | raw_corpus | exports.post = (callback) ->
data = 'clientid=15808069&psessionid=null&r=%7B%22status%22%3A%22online%22%2C%22ptwebqq%22%3A%223d1965f179ab2889b44d4f04636fbf821925d33b22ca4563f57432b5717d0320%22%2C%22passwd_sig%22%3A%22%22%2C%22clientid%22%3A%2215808069%22%2C%22psessionid%22%3Anull%7D'
cookie = "uin=o0123774072; ... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 168 | 191 | ||
xhan/qqbot:src/qqapi.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.post = (callback) ->
data = 'clientid=15808069&psessionid=null&r=%7B%22status%22%3A%22online%22%2C%22ptwebqq%22%3A%223d1965f179ab2889b44d4f04636fbf821925d33b22ca4563f57432b5717d0320%22%2C%22passwd_sig%22%3A%22%22%2C%22clientid%22%3A%2215808069%22%2C%2... | exports.post = function(callback) {
var body, cookie, data, options, req;
data = 'clientid=15808069&psessionid=null&r=%7B%22status%22%3A%22online%22%2C%22ptwebqq%22%3A%223d1965f179ab2889b44d4f04636fbf821925d33b22ca4563f57432b5717d0320%22%2C%22passwd_sig%22%3A%22%22%2C%22clientid%22%3A%2215808069%22%2C%22psessionid%... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 168 | 191 |
xhan/qqbot:src/qqapi.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.post = function(callback) {
var body, cookie, data, options, req;
data = 'clientid=15808069&psessionid=null&r=%7B%22status%22%3A%22online%22%2C%22ptwebqq%22%3A%223d1965f179ab2889b44d4f04636fbf821925d33b22ca4563f57432b5717d0320%22%2C%22passwd_sig%22%3A%2... | exports.post = (callback) ->
data = 'clientid=15808069&psessionid=null&r=%7B%22status%22%3A%22online%22%2C%22ptwebqq%22%3A%223d1965f179ab2889b44d4f04636fbf821925d33b22ca4563f57432b5717d0320%22%2C%22passwd_sig%22%3A%22%22%2C%22clientid%22%3A%2215808069%22%2C%22psessionid%22%3Anull%7D'
cookie = "uin=o0123774072; ... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 168 | 191 |
xhan/qqbot:src/qqapi.coffee:8:completion | completion | exports.post = (callback) ->
data = 'clientid=15808069&psessionid=null&r=%7B%22status%22%3A%22online%22%2C%22ptwebqq%22%3A%223d1965f179ab2889b44d4f04636fbf821925d33b22ca4563f57432b5717d0320%22%2C%22passwd_sig%22%3A%22%22%2C%22clientid%22%3A%2215808069%22%2C%22psessionid%22%3Anull%7D'
cookie = "uin=o0123774072; ... | 'Content-Length': Buffer.byteLength(data),
'Cookie' : cookie
req = http.request options, (resp) ->
log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
ret = JSON.parse(body)
callback( ret )
req.wri... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | fff65761b7213e4922c46c3c5e509ecff6fac7a6 | 1,435 | https://github.com/xhan/qqbot/blob/fff65761b7213e4922c46c3c5e509ecff6fac7a6/src/qqapi.coffee | 168 | 191 |
xhan/qqbot:src/qqapi.coffee:4:raw_corpus | raw_corpus | exports.encode_password = (password , token , bits) ->
password = md5(password)
bits = bits.replace(/\\x/g,'')
hex2ascii = (hexstr) ->
hexstr.match(/\w{2}/g)
.map (byte_str) ->
String.fromCharCode parseInt(byte_str,16)
.join('')
ret = md5( hex2asc... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6 | 1,435 | https://github.com/xhan/qqbot/blob/e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6/src/qqapi.coffee | 55 | 72 | ||
xhan/qqbot:src/qqapi.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.encode_password = (password , token , bits) ->
password = md5(password)
bits = bits.replace(/\\x/g,'')
hex2ascii = (hexstr) ->
hexstr.match(/\w{2}/g)
.map (byte_str) ->
String.fromCharCode parseInt(byt... | exports.encode_password = function(password, token, bits) {
var hex2ascii, ret;
password = md5(password);
bits = bits.replace(/\\x/g, '');
hex2ascii = function(hexstr) {
return hexstr.match(/\w{2}/g).map(function(byte_str) {
return String.fromCharCode(parseInt(byte_str, 16));
}).join('');
};
r... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6 | 1,435 | https://github.com/xhan/qqbot/blob/e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6/src/qqapi.coffee | 55 | 72 |
xhan/qqbot:src/qqapi.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.encode_password = function(password, token, bits) {
var hex2ascii, ret;
password = md5(password);
bits = bits.replace(/\\x/g, '');
hex2ascii = function(hexstr) {
return hexstr.match(/\w{2}/g).map(function(byte_str) {
return String.fromChar... | exports.encode_password = (password , token , bits) ->
password = md5(password)
bits = bits.replace(/\\x/g,'')
hex2ascii = (hexstr) ->
hexstr.match(/\w{2}/g)
.map (byte_str) ->
String.fromCharCode parseInt(byte_str,16)
.join('')
ret = md5( hex2asc... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6 | 1,435 | https://github.com/xhan/qqbot/blob/e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6/src/qqapi.coffee | 55 | 72 |
xhan/qqbot:src/qqapi.coffee:4:completion | completion | exports.encode_password = (password , token , bits) ->
password = md5(password)
bits = bits.replace(/\\x/g,'')
hex2ascii = (hexstr) ->
hexstr.match(/\w{2}/g)
.map (byte_str) ->
String.fromCharCode parseInt(byte_str,16) | .join('')
ret = md5( hex2ascii(password) + hex2ascii(bits) ).toUpperCase() + token
ret = md5( ret ).toUpperCase()
return ret
# 登录 | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6 | 1,435 | https://github.com/xhan/qqbot/blob/e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6/src/qqapi.coffee | 55 | 72 |
xhan/qqbot:src/qqapi.coffee:5:raw_corpus | raw_corpus | exports.login = (qq, encode_password, verifycode, cookies , callback) ->
# path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&h=1&ptredirect=0&ptlang=2052&from_ui=1&ptt... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6 | 1,435 | https://github.com/xhan/qqbot/blob/e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6/src/qqapi.coffee | 73 | 96 | ||
xhan/qqbot:src/qqapi.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.login = (qq, encode_password, verifycode, cookies , callback) ->
# path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26w... | exports.login = function(qq, encode_password, verifycode, cookies, callback) {
var body, options, path;
// path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&h=1&ptredi... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6 | 1,435 | https://github.com/xhan/qqbot/blob/e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6/src/qqapi.coffee | 73 | 96 |
xhan/qqbot:src/qqapi.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.login = function(qq, encode_password, verifycode, cookies, callback) {
var body, options, path;
// path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb.qq.com%2Flogi... | exports.login = (qq, encode_password, verifycode, cookies , callback) ->
# path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&h=1&ptredirect=0&ptlang=2052&from_ui=1&ptt... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6 | 1,435 | https://github.com/xhan/qqbot/blob/e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6/src/qqapi.coffee | 73 | 96 |
xhan/qqbot:src/qqapi.coffee:5:completion | completion | exports.login = (qq, encode_password, verifycode, cookies , callback) ->
# path = "/login?u=#{qq}&p=#{encode_password}&verifycode=#{verifycode}&webqq_type=10&remember_uin=1&login2qq=1&aid=1003903&u1=http%3A%2F%2Fweb.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&h=1&ptredirect=0&ptlang=2052&from_ui=1&ptt... | .get options , (resp) ->
log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk;
resp.on 'end', ->
ret = body.match(/\'(.*?)\'/g).map (i)->
last = i.length - 2
i.substr(1 ,last)
... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6 | 1,435 | https://github.com/xhan/qqbot/blob/e2e8fa0cb6b02a9f854f7bc6c89ff00fedb581f6/src/qqapi.coffee | 73 | 96 |
xhan/qqbot:src/qqapi.coffee:1:raw_corpus | raw_corpus | https = require "https"
crypto = require 'crypto'
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
# 是否需要 验证码
# @param qq
# @param result -> [是否需要验证码 , token , bits ]
exports.check_qq = (qq, result) ->
# TODO: random -> r
url =... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 831c3670af9a58e3c7b3477df08e30f376cc3235 | 1,435 | https://github.com/xhan/qqbot/blob/831c3670af9a58e3c7b3477df08e30f376cc3235/src/qqapi.coffee | 1 | 50 | ||
xhan/qqbot:src/qqapi.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
https = require "https"
crypto = require 'crypto'
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
# 是否需要 验证码
# @param qq
# @param result -> [是否需要验证码 , token , bits ]
exports.che... | var crypto, https, log, md5;
https = require("https");
crypto = require('crypto');
md5 = function(str) {
var md5sum;
md5sum = crypto.createHash('md5');
return md5sum.update(str).digest('hex');
};
// TODO: logger 分级控制
log = console.log;
// 是否需要 验证码
// @param qq
// @param result -> [是否需要验证码 , token , bits ]
ex... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 831c3670af9a58e3c7b3477df08e30f376cc3235 | 1,435 | https://github.com/xhan/qqbot/blob/831c3670af9a58e3c7b3477df08e30f376cc3235/src/qqapi.coffee | 1 | 50 |
xhan/qqbot:src/qqapi.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var crypto, https, log, md5;
https = require("https");
crypto = require('crypto');
md5 = function(str) {
var md5sum;
md5sum = crypto.createHash('md5');
return md5sum.update(str).digest('hex');
};
// TODO: logger 分级控制
log = console.log;
// 是否需要 验证码
// @pa... | https = require "https"
crypto = require 'crypto'
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
# 是否需要 验证码
# @param qq
# @param result -> [是否需要验证码 , token , bits ]
exports.check_qq = (qq, result) ->
# TODO: random -> r
url =... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 831c3670af9a58e3c7b3477df08e30f376cc3235 | 1,435 | https://github.com/xhan/qqbot/blob/831c3670af9a58e3c7b3477df08e30f376cc3235/src/qqapi.coffee | 1 | 50 |
xhan/qqbot:src/qqapi.coffee:1:completion | completion | https = require "https"
crypto = require 'crypto'
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
# 是否需要 验证码
# @param qq
# @param result -> [是否需要验证码 , token , bits ]
exports.check_qq = (qq, result) ->
# TODO: random -> r
url =... | resp.on 'end', ->
log body
ret = body.match(/\'(.*?)\'/g).map (i)->
last = i.length - 2
i.substr(1 ,last)
log ret
result( ret )
.on "error", (e) ->
log e
exports.encode_password = (password ,... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 831c3670af9a58e3c7b3477df08e30f376cc3235 | 1,435 | https://github.com/xhan/qqbot/blob/831c3670af9a58e3c7b3477df08e30f376cc3235/src/qqapi.coffee | 1 | 50 |
xhan/qqbot:src/qqapi.coffee:1:raw_corpus | raw_corpus | https = require "https"
log = console.log
# 是否需要 验证码
exports.check_qq = (qq) ->
# TODO: random -> r
url = "https://ssl.ptlogin2.qq.com/check?uin=#{qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522"
body = '';
https
.get url , (resp) ->
log "response: #{resp.statusCode}"... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 06be78522668c8d9f7a4de963c9d8a2fb256128d | 1,435 | https://github.com/xhan/qqbot/blob/06be78522668c8d9f7a4de963c9d8a2fb256128d/src/qqapi.coffee | 1 | 22 | ||
xhan/qqbot:src/qqapi.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
https = require "https"
log = console.log
# 是否需要 验证码
exports.check_qq = (qq) ->
# TODO: random -> r
url = "https://ssl.ptlogin2.qq.com/check?uin=#{qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522"
body = '';
https
.get url ,... | var https, log;
https = require("https");
log = console.log;
// 是否需要 验证码
exports.check_qq = function(qq) {
var body, url;
// TODO: random -> r
url = `https://ssl.ptlogin2.qq.com/check?uin=${qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522`;
body = '';
return https.get(url, function(resp) {
... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 06be78522668c8d9f7a4de963c9d8a2fb256128d | 1,435 | https://github.com/xhan/qqbot/blob/06be78522668c8d9f7a4de963c9d8a2fb256128d/src/qqapi.coffee | 1 | 22 |
xhan/qqbot:src/qqapi.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var https, log;
https = require("https");
log = console.log;
// 是否需要 验证码
exports.check_qq = function(qq) {
var body, url;
// TODO: random -> r
url = `https://ssl.ptlogin2.qq.com/check?uin=${qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522`;
... | https = require "https"
log = console.log
# 是否需要 验证码
exports.check_qq = (qq) ->
# TODO: random -> r
url = "https://ssl.ptlogin2.qq.com/check?uin=#{qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522"
body = '';
https
.get url , (resp) ->
log "response: #{resp.statusCode}"... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 06be78522668c8d9f7a4de963c9d8a2fb256128d | 1,435 | https://github.com/xhan/qqbot/blob/06be78522668c8d9f7a4de963c9d8a2fb256128d/src/qqapi.coffee | 1 | 22 |
xhan/qqbot:src/qqapi.coffee:1:completion | completion | https = require "https"
log = console.log
# 是否需要 验证码
exports.check_qq = (qq) ->
# TODO: random -> r
url = "https://ssl.ptlogin2.qq.com/check?uin=#{qq}&appid=1003903&js_ver=10062&js_type=0&r=0.6569391019121522"
body = '';
https
.get url , (resp) ->
log "response: #{resp.statusCode}"... | body += chunk;
resp.on 'end', ->
log body
ret = body.match(/\'(.*?)\'/g).map (i)->
last = i.length - 2
i.substr(1 ,last)
log ret
.on "error", (e) ->
log e | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 06be78522668c8d9f7a4de963c9d8a2fb256128d | 1,435 | https://github.com/xhan/qqbot/blob/06be78522668c8d9f7a4de963c9d8a2fb256128d/src/qqapi.coffee | 1 | 22 |
yakyak/yakyak:src/ui/views/controller.coffee:1:raw_corpus | raw_corpus | setLeftSize = (left) ->
document.querySelector('.left').style.width = left + 'px'
document.querySelector('.leftresize').style.left = (left - 2) + 'px' | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 29 | 31 | ||
yakyak/yakyak:src/ui/views/controller.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setLeftSize = (left) ->
document.querySelector('.left').style.width = left + 'px'
document.querySelector('.leftresize').style.left = (left - 2) + 'px'
``` | var setLeftSize;
setLeftSize = function(left) {
document.querySelector('.left').style.width = left + 'px';
return document.querySelector('.leftresize').style.left = (left - 2) + 'px';
}; | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 29 | 31 |
yakyak/yakyak:src/ui/views/controller.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var setLeftSize;
setLeftSize = function(left) {
document.querySelector('.left').style.width = left + 'px';
return document.querySelector('.leftresize').style.left = (left - 2) + 'px';
};
``` | setLeftSize = (left) ->
document.querySelector('.left').style.width = left + 'px'
document.querySelector('.leftresize').style.left = (left - 2) + 'px' | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 29 | 31 |
yakyak/yakyak:src/ui/views/controller.coffee:2:raw_corpus | raw_corpus | setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
document.querySelector('.leftresize').classList.remove("mi... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 33 | 82 | ||
yakyak/yakyak:src/ui/views/controller.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
d... | var setConvMin;
setConvMin = function(convmin) {
if (convmin) {
document.querySelector('.left').classList.add("minimal");
return document.querySelector('.leftresize').classList.add("minimal");
} else {
document.querySelector('.left').classList.remove("minimal");
return document.querySelector('.left... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 33 | 82 |
yakyak/yakyak:src/ui/views/controller.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var setConvMin;
setConvMin = function(convmin) {
if (convmin) {
document.querySelector('.left').classList.add("minimal");
return document.querySelector('.leftresize').classList.add("minimal");
} else {
document.querySelector('.left').classList.remo... | setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
document.querySelector('.leftresize').classList.remove("mi... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 33 | 82 |
yakyak/yakyak:src/ui/views/controller.coffee:2:completion | completion | setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
document.querySelector('.leftresize').classList.remove("mi... | applayout.main null
applayout.maininfo null
applayout.foot null
applayout.last startup
document.body.style.zoom = viewstate.zoom
document.body.style.setProperty('--zoom', viewstate.zoom)
else if viewstate.state == viewstate.STATE_NORMAL
redraw()
applayout.lfo... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 33 | 82 |
yakyak/yakyak:src/ui/views/controller.coffee:3:raw_corpus | raw_corpus | about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else if viewstate.state == viewstate.STATE_ADD_CONVERSATION
redraw()
applayout.left convlist
applayout.main convadd
ap... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 83 | 114 | ||
yakyak/yakyak:src/ui/views/controller.coffee:3:completion | completion | about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else if viewstate.state == viewstate.STATE_ADD_CONVERSATION
redraw()
applayout.left convlist
applayout.main convadd
ap... | redraw()
handle 'update:conv', ->
redraw()
handle 'update:conv_count', ->
dockicon viewstate
trayicon models
handle 'update:searchedentities', ->
redraw()
handle 'update:selectedEntities', ->
redraw()
handle 'update:convsettings', -> redraw() | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 83 | 114 |
yakyak/yakyak:src/ui/views/controller.coffee:4:raw_corpus | raw_corpus | redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
handle 'update:language', ->
menu viewstate
redraw() | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 116 | 131 | ||
yakyak/yakyak:src/ui/views/controller.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
handle 'update:language', ->
menu viewstate... | var redraw;
redraw = function() {
notifications(models);
convhead(models);
controls(models);
convlist(models);
listhead(models);
messages(models);
typinginfo(models);
input(models);
convadd(models);
return startup(models);
};
handle('update:language', function() {
menu(viewstate);
return redra... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 116 | 131 |
yakyak/yakyak:src/ui/views/controller.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var redraw;
redraw = function() {
notifications(models);
convhead(models);
controls(models);
convlist(models);
listhead(models);
messages(models);
typinginfo(models);
input(models);
convadd(models);
return startup(models);
};
handle('update:la... | redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
handle 'update:language', ->
menu viewstate
redraw() | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 116 | 131 |
yakyak/yakyak:src/ui/views/controller.coffee:4:completion | completion | redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models | input models
convadd models
startup models
handle 'update:language', ->
menu viewstate
redraw() | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 116 | 131 |
yakyak/yakyak:src/ui/views/controller.coffee:5:raw_corpus | raw_corpus | throttle = (fn, time=10) ->
timeout = false
# return a throttled version of fn
# which executes on the trailing end of `time`
throttled = ->
return if timeout
timeout = setTimeout ->
fn()
timeout = false
,
time
redraw = throttle(redraw, 20)
h... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 133 | 169 | ||
yakyak/yakyak:src/ui/views/controller.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
throttle = (fn, time=10) ->
timeout = false
# return a throttled version of fn
# which executes on the trailing end of `time`
throttled = ->
return if timeout
timeout = setTimeout ->
fn()
timeout = false
... | var redraw, throttle;
throttle = function(fn, time = 10) {
var throttled, timeout;
timeout = false;
// return a throttled version of fn
// which executes on the trailing end of `time`
return throttled = function() {
if (timeout) {
return;
}
return timeout = setTimeout(function() {
fn(... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 133 | 169 |
yakyak/yakyak:src/ui/views/controller.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var redraw, throttle;
throttle = function(fn, time = 10) {
var throttled, timeout;
timeout = false;
// return a throttled version of fn
// which executes on the trailing end of `time`
return throttled = function() {
if (timeout) {
return;
}... | throttle = (fn, time=10) ->
timeout = false
# return a throttled version of fn
# which executes on the trailing end of `time`
throttled = ->
return if timeout
timeout = setTimeout ->
fn()
timeout = false
,
time
redraw = throttle(redraw, 20)
h... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 133 | 169 |
yakyak/yakyak:src/ui/views/controller.coffee:5:completion | completion | throttle = (fn, time=10) ->
timeout = false
# return a throttled version of fn
# which executes on the trailing end of `time`
throttled = ->
return if timeout
timeout = setTimeout ->
fn()
timeout = false
,
time
redraw = throttle(redraw, 20)
h... | handle 'update:switchConv', ->
messages.scrollToBottom()
handle 'update:beforeHistory', ->
applayout.recordMainPos()
handle 'update:afterHistory', ->
applayout.adjustMainPos()
handle 'update:beforeImg', ->
applayout.recordMainPos()
handle 'update:afterImg', ->
if viewstate.atbottom
message... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4 | 3,762 | https://github.com/yakyak/yakyak/blob/73c7da0eec2c0c09ccddabb2d1228b9cd8016fe4/src/ui/views/controller.coffee | 133 | 169 |
yakyak/yakyak:src/ui/views/controller.coffee:2:raw_corpus | raw_corpus | setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
document.querySelector('.leftresize').classList.remove("mi... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 4e885d80bde84ce11e4f92fbd520524ac08c4488 | 3,762 | https://github.com/yakyak/yakyak/blob/4e885d80bde84ce11e4f92fbd520524ac08c4488/src/ui/views/controller.coffee | 33 | 82 | ||
yakyak/yakyak:src/ui/views/controller.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
d... | var setConvMin;
setConvMin = function(convmin) {
if (convmin) {
document.querySelector('.left').classList.add("minimal");
return document.querySelector('.leftresize').classList.add("minimal");
} else {
document.querySelector('.left').classList.remove("minimal");
return document.querySelector('.left... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 4e885d80bde84ce11e4f92fbd520524ac08c4488 | 3,762 | https://github.com/yakyak/yakyak/blob/4e885d80bde84ce11e4f92fbd520524ac08c4488/src/ui/views/controller.coffee | 33 | 82 |
yakyak/yakyak:src/ui/views/controller.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var setConvMin;
setConvMin = function(convmin) {
if (convmin) {
document.querySelector('.left').classList.add("minimal");
return document.querySelector('.leftresize').classList.add("minimal");
} else {
document.querySelector('.left').classList.remo... | setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
document.querySelector('.leftresize').classList.remove("mi... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 4e885d80bde84ce11e4f92fbd520524ac08c4488 | 3,762 | https://github.com/yakyak/yakyak/blob/4e885d80bde84ce11e4f92fbd520524ac08c4488/src/ui/views/controller.coffee | 33 | 82 |
yakyak/yakyak:src/ui/views/controller.coffee:2:completion | completion | setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
document.querySelector('.leftresize').classList.remove("mi... | # only render startup
startup(models)
applayout.left null
applayout.convhead null
applayout.main null
applayout.maininfo null
applayout.foot null
applayout.last startup
document.body.style.zoom = viewstate.zoom
document.body.style.setProperty('--... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 4e885d80bde84ce11e4f92fbd520524ac08c4488 | 3,762 | https://github.com/yakyak/yakyak/blob/4e885d80bde84ce11e4f92fbd520524ac08c4488/src/ui/views/controller.coffee | 33 | 82 |
yakyak/yakyak:src/ui/views/controller.coffee:3:raw_corpus | raw_corpus | else
applayout.last null
menu viewstate
dockicon viewstate
trayicon models
else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maini... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 4e885d80bde84ce11e4f92fbd520524ac08c4488 | 3,762 | https://github.com/yakyak/yakyak/blob/4e885d80bde84ce11e4f92fbd520524ac08c4488/src/ui/views/controller.coffee | 83 | 123 | ||
yakyak/yakyak:src/ui/views/controller.coffee:3:completion | completion | else
applayout.last null
menu viewstate
dockicon viewstate
trayicon models
else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maini... | applayout.foot null
else
console.log 'unknown viewstate.state', viewstate.state
handle 'update:entity', ->
redraw()
handle 'update:conv', ->
redraw()
handle 'update:conv_count', ->
dockicon viewstate
trayicon models
handle 'update:searchedentities', ->
redraw()
handle 'update:selected... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 4e885d80bde84ce11e4f92fbd520524ac08c4488 | 3,762 | https://github.com/yakyak/yakyak/blob/4e885d80bde84ce11e4f92fbd520524ac08c4488/src/ui/views/controller.coffee | 83 | 123 |
yakyak/yakyak:src/ui/views/controller.coffee:2:raw_corpus | raw_corpus | setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
document.querySelector('.leftresize').classList.remove("mi... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | fa4b415dded69c8728161463a36dff2a7bbc086e | 3,762 | https://github.com/yakyak/yakyak/blob/fa4b415dded69c8728161463a36dff2a7bbc086e/src/ui/views/controller.coffee | 33 | 82 | ||
yakyak/yakyak:src/ui/views/controller.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
d... | var setConvMin;
setConvMin = function(convmin) {
if (convmin) {
document.querySelector('.left').classList.add("minimal");
return document.querySelector('.leftresize').classList.add("minimal");
} else {
document.querySelector('.left').classList.remove("minimal");
return document.querySelector('.left... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | fa4b415dded69c8728161463a36dff2a7bbc086e | 3,762 | https://github.com/yakyak/yakyak/blob/fa4b415dded69c8728161463a36dff2a7bbc086e/src/ui/views/controller.coffee | 33 | 82 |
yakyak/yakyak:src/ui/views/controller.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var setConvMin;
setConvMin = function(convmin) {
if (convmin) {
document.querySelector('.left').classList.add("minimal");
return document.querySelector('.leftresize').classList.add("minimal");
} else {
document.querySelector('.left').classList.remo... | setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
document.querySelector('.leftresize').classList.remove("mi... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | fa4b415dded69c8728161463a36dff2a7bbc086e | 3,762 | https://github.com/yakyak/yakyak/blob/fa4b415dded69c8728161463a36dff2a7bbc086e/src/ui/views/controller.coffee | 33 | 82 |
yakyak/yakyak:src/ui/views/controller.coffee:2:completion | completion | setConvMin = (convmin) ->
if convmin
document.querySelector('.left').classList.add("minimal")
document.querySelector('.leftresize').classList.add("minimal")
else
document.querySelector('.left').classList.remove("minimal")
document.querySelector('.leftresize').classList.remove("mi... | startup(models)
applayout.left null
applayout.convhead null
applayout.main null
applayout.maininfo null
applayout.foot null
applayout.last startup
document.body.style.zoom = viewstate.zoom
document.body.style.setProperty('--zoom', viewstate.zoom)
els... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | fa4b415dded69c8728161463a36dff2a7bbc086e | 3,762 | https://github.com/yakyak/yakyak/blob/fa4b415dded69c8728161463a36dff2a7bbc086e/src/ui/views/controller.coffee | 33 | 82 |
yakyak/yakyak:src/ui/views/controller.coffee:3:raw_corpus | raw_corpus | menu viewstate
dockicon viewstate
trayicon models
else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else ... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | fa4b415dded69c8728161463a36dff2a7bbc086e | 3,762 | https://github.com/yakyak/yakyak/blob/fa4b415dded69c8728161463a36dff2a7bbc086e/src/ui/views/controller.coffee | 83 | 116 | ||
yakyak/yakyak:src/ui/views/controller.coffee:3:completion | completion | menu viewstate
dockicon viewstate
trayicon models
else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else ... | applayout.foot null
else
console.log 'unknown viewstate.state', viewstate.state
handle 'update:entity', ->
redraw()
handle 'update:conv', ->
redraw()
handle 'update:searchedentities', ->
redraw()
handle 'update:selectedEntities', ->
redraw()
handle 'update:convsettings', -> redraw() | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | fa4b415dded69c8728161463a36dff2a7bbc086e | 3,762 | https://github.com/yakyak/yakyak/blob/fa4b415dded69c8728161463a36dff2a7bbc086e/src/ui/views/controller.coffee | 83 | 116 |
yakyak/yakyak:src/ui/views/controller.coffee:3:raw_corpus | raw_corpus | menu viewstate
dockicon viewstate
trayicon models
else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else ... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | fcea1ff474a0e236587d4127ca18ddf9aa9cbcaf | 3,762 | https://github.com/yakyak/yakyak/blob/fcea1ff474a0e236587d4127ca18ddf9aa9cbcaf/src/ui/views/controller.coffee | 82 | 119 | ||
yakyak/yakyak:src/ui/views/controller.coffee:3:completion | completion | menu viewstate
dockicon viewstate
trayicon models
else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else ... | console.log 'unknown viewstate.state', viewstate.state
handle 'update:entity', ->
redraw()
handle 'update:conv', ->
redraw()
handle 'update:conv_count', ->
dockicon viewstate
trayicon models
handle 'update:searchedentities', ->
redraw()
handle 'update:selectedEntities', ->
redraw()
handle 'upd... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | fcea1ff474a0e236587d4127ca18ddf9aa9cbcaf | 3,762 | https://github.com/yakyak/yakyak/blob/fcea1ff474a0e236587d4127ca18ddf9aa9cbcaf/src/ui/views/controller.coffee | 82 | 119 |
yakyak/yakyak:src/ui/views/controller.coffee:4:raw_corpus | raw_corpus | redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
handle 'update:language', ->
menu viewstate
redraw()
handle 'update:switchConv', ->
message... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 53dea6f05ca738d9cb9eb66022f538066c655b32 | 3,762 | https://github.com/yakyak/yakyak/blob/53dea6f05ca738d9cb9eb66022f538066c655b32/src/ui/views/controller.coffee | 117 | 152 | ||
yakyak/yakyak:src/ui/views/controller.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
handle 'update:language', ->
menu viewstate... | var redraw;
redraw = function() {
notifications(models);
convhead(models);
controls(models);
convlist(models);
listhead(models);
messages(models);
typinginfo(models);
input(models);
convadd(models);
return startup(models);
};
handle('update:language', function() {
menu(viewstate);
return redra... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 53dea6f05ca738d9cb9eb66022f538066c655b32 | 3,762 | https://github.com/yakyak/yakyak/blob/53dea6f05ca738d9cb9eb66022f538066c655b32/src/ui/views/controller.coffee | 117 | 152 |
yakyak/yakyak:src/ui/views/controller.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var redraw;
redraw = function() {
notifications(models);
convhead(models);
controls(models);
convlist(models);
listhead(models);
messages(models);
typinginfo(models);
input(models);
convadd(models);
return startup(models);
};
handle('update:la... | redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
handle 'update:language', ->
menu viewstate
redraw()
handle 'update:switchConv', ->
message... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 53dea6f05ca738d9cb9eb66022f538066c655b32 | 3,762 | https://github.com/yakyak/yakyak/blob/53dea6f05ca738d9cb9eb66022f538066c655b32/src/ui/views/controller.coffee | 117 | 152 |
yakyak/yakyak:src/ui/views/controller.coffee:4:completion | completion | redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
handle 'update:language', ->
menu viewstate
redraw()
handle 'update:switchConv', -> | messages.scrollToBottom()
handle 'update:beforeHistory', ->
applayout.recordMainPos()
handle 'update:afterHistory', ->
applayout.adjustMainPos()
handle 'update:beforeImg', ->
applayout.recordMainPos()
handle 'update:afterImg', ->
if viewstate.atbottom
messages.scrollToBottom()
else
... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 53dea6f05ca738d9cb9eb66022f538066c655b32 | 3,762 | https://github.com/yakyak/yakyak/blob/53dea6f05ca738d9cb9eb66022f538066c655b32/src/ui/views/controller.coffee | 117 | 152 |
yakyak/yakyak:src/ui/views/controller.coffee:3:raw_corpus | raw_corpus | else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else if viewstate.state == viewstate.STATE_ADD_CONVERSATION
redraw()... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | ddc0b677fb900e48ad717cda37f569a467e2cc80 | 3,762 | https://github.com/yakyak/yakyak/blob/ddc0b677fb900e48ad717cda37f569a467e2cc80/src/ui/views/controller.coffee | 82 | 111 | ||
yakyak/yakyak:src/ui/views/controller.coffee:3:completion | completion | else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else if viewstate.state == viewstate.STATE_ADD_CONVERSATION
redraw()... | console.log 'unknown viewstate.state', viewstate.state
handle 'update:entity', ->
redraw()
handle 'update:conv', ->
redraw()
handle 'update:searchedentities', ->
redraw()
handle 'update:selectedEntities', ->
redraw()
handle 'update:convsettings', -> redraw() | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | ddc0b677fb900e48ad717cda37f569a467e2cc80 | 3,762 | https://github.com/yakyak/yakyak/blob/ddc0b677fb900e48ad717cda37f569a467e2cc80/src/ui/views/controller.coffee | 82 | 111 |
yakyak/yakyak:src/ui/views/controller.coffee:4:raw_corpus | raw_corpus | redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
trayicon models
menu viewstate
dockicon viewstate | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | ddc0b677fb900e48ad717cda37f569a467e2cc80 | 3,762 | https://github.com/yakyak/yakyak/blob/ddc0b677fb900e48ad717cda37f569a467e2cc80/src/ui/views/controller.coffee | 113 | 126 | ||
yakyak/yakyak:src/ui/views/controller.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
trayicon models
menu viewstate
dockic... | var redraw;
redraw = function() {
notifications(models);
convhead(models);
controls(models);
convlist(models);
listhead(models);
messages(models);
typinginfo(models);
input(models);
convadd(models);
startup(models);
trayicon(models);
menu(viewstate);
return dockicon(viewstate);
}; | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | ddc0b677fb900e48ad717cda37f569a467e2cc80 | 3,762 | https://github.com/yakyak/yakyak/blob/ddc0b677fb900e48ad717cda37f569a467e2cc80/src/ui/views/controller.coffee | 113 | 126 |
yakyak/yakyak:src/ui/views/controller.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var redraw;
redraw = function() {
notifications(models);
convhead(models);
controls(models);
convlist(models);
listhead(models);
messages(models);
typinginfo(models);
input(models);
convadd(models);
startup(models);
trayicon(models);
menu(v... | redraw = ->
notifications models
convhead models
controls models
convlist models
listhead models
messages models
typinginfo models
input models
convadd models
startup models
trayicon models
menu viewstate
dockicon viewstate | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | ddc0b677fb900e48ad717cda37f569a467e2cc80 | 3,762 | https://github.com/yakyak/yakyak/blob/ddc0b677fb900e48ad717cda37f569a467e2cc80/src/ui/views/controller.coffee | 113 | 126 |
yakyak/yakyak:src/ui/views/controller.coffee:5:raw_corpus | raw_corpus | throttle = (fn, time=10) ->
timeout = false
# return a throttled version of fn
# which executes on the trailing end of `time`
throttled = ->
return if timeout
timeout = setTimeout ->
fn()
timeout = false
,
time
redraw = throttle(redraw, 20)
h... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | ddc0b677fb900e48ad717cda37f569a467e2cc80 | 3,762 | https://github.com/yakyak/yakyak/blob/ddc0b677fb900e48ad717cda37f569a467e2cc80/src/ui/views/controller.coffee | 128 | 160 | ||
yakyak/yakyak:src/ui/views/controller.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
throttle = (fn, time=10) ->
timeout = false
# return a throttled version of fn
# which executes on the trailing end of `time`
throttled = ->
return if timeout
timeout = setTimeout ->
fn()
timeout = false
... | var redraw, throttle;
throttle = function(fn, time = 10) {
var throttled, timeout;
timeout = false;
// return a throttled version of fn
// which executes on the trailing end of `time`
return throttled = function() {
if (timeout) {
return;
}
return timeout = setTimeout(function() {
fn(... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | ddc0b677fb900e48ad717cda37f569a467e2cc80 | 3,762 | https://github.com/yakyak/yakyak/blob/ddc0b677fb900e48ad717cda37f569a467e2cc80/src/ui/views/controller.coffee | 128 | 160 |
yakyak/yakyak:src/ui/views/controller.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var redraw, throttle;
throttle = function(fn, time = 10) {
var throttled, timeout;
timeout = false;
// return a throttled version of fn
// which executes on the trailing end of `time`
return throttled = function() {
if (timeout) {
return;
}... | throttle = (fn, time=10) ->
timeout = false
# return a throttled version of fn
# which executes on the trailing end of `time`
throttled = ->
return if timeout
timeout = setTimeout ->
fn()
timeout = false
,
time
redraw = throttle(redraw, 20)
h... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | ddc0b677fb900e48ad717cda37f569a467e2cc80 | 3,762 | https://github.com/yakyak/yakyak/blob/ddc0b677fb900e48ad717cda37f569a467e2cc80/src/ui/views/controller.coffee | 128 | 160 |
yakyak/yakyak:src/ui/views/controller.coffee:5:completion | completion | throttle = (fn, time=10) ->
timeout = false
# return a throttled version of fn
# which executes on the trailing end of `time`
throttled = ->
return if timeout
timeout = setTimeout ->
fn()
timeout = false
,
time
redraw = throttle(redraw, 20)
h... | handle 'update:beforeHistory', ->
applayout.recordMainPos()
handle 'update:afterHistory', ->
applayout.adjustMainPos()
handle 'update:beforeImg', ->
applayout.recordMainPos()
handle 'update:afterImg', ->
if viewstate.atbottom
messages.scrollToBottom()
else
applayout.adjustMainPos()
... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | ddc0b677fb900e48ad717cda37f569a467e2cc80 | 3,762 | https://github.com/yakyak/yakyak/blob/ddc0b677fb900e48ad717cda37f569a467e2cc80/src/ui/views/controller.coffee | 128 | 160 |
yakyak/yakyak:src/ui/views/controller.coffee:3:raw_corpus | raw_corpus | menu viewstate
dockicon viewstate
else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else if viewstate.state == vi... | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 1603aeb4cc20c273c8aadcd3d8047e73a5966810 | 3,762 | https://github.com/yakyak/yakyak/blob/1603aeb4cc20c273c8aadcd3d8047e73a5966810/src/ui/views/controller.coffee | 82 | 114 | ||
yakyak/yakyak:src/ui/views/controller.coffee:3:completion | completion | menu viewstate
dockicon viewstate
else if viewstate.state == viewstate.STATE_ABOUT
redraw()
about models
applayout.left convlist
applayout.main about
applayout.convhead null
applayout.maininfo null
applayout.foot null
else if viewstate.state == vi... | applayout.foot null
else
console.log 'unknown viewstate.state', viewstate.state
handle 'update:entity', ->
redraw()
handle 'update:conv', ->
redraw()
handle 'update:searchedentities', ->
redraw()
handle 'update:selectedEntities', ->
redraw()
handle 'update:convsettings', -> redraw() | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/views/controller.coffee | MIT | 1603aeb4cc20c273c8aadcd3d8047e73a5966810 | 3,762 | https://github.com/yakyak/yakyak/blob/1603aeb4cc20c273c8aadcd3d8047e73a5966810/src/ui/views/controller.coffee | 82 | 114 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.