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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
soyjavi/QuoJS:src/quo.ajax.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
(function($$) {
var DEFAULT, JSONP_ID, MIME_TYPES;
DEFAULT = {
TYPE: "GET",
MIME: "json"
};
MIME_TYPES = {
script: "text/javascript, application/javascript",
json: "application/json",
xml: "application/xml, text/xml",
html: "text/htm... | do ($$ = Quo) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
html: "text/html"
text: "text/plain"
JSONP_ID = 0
$$.ajaxSettings =
... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 1 | 41 |
soyjavi/QuoJS:src/quo.ajax.coffee:1:completion | completion | do ($$ = Quo) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
html: "text/html"
text: "text/plain"
JSONP_ID = 0
$$.ajaxSettings =
... | dataType: DEFAULT.MIME
headers: {}
xhr: -> new window.XMLHttpRequest()
crossDomain: false
timeout: 0
$$.ajax = (options) ->
settings = $$.mix($$.ajaxSettings, options)
if settings.type is DEFAULT.TYPE
settings.url += $$.serializeParameters(settings.data,... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 1 | 41 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:raw_corpus | raw_corpus | xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr, settings
if settings.timeout > 0
abortTimeout = setTimeout((-> _xhrTimeout xhr, settings ), settings.timeout)
try
xhr.send settings.data
catch error
xhr = error
_xhrErr... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 43 | 86 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:2:completion | completion | xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr, settings
if settings.timeout > 0
abortTimeout = setTimeout((-> _xhrTimeout xhr, settings ), settings.timeout)
try
xhr.send settings.data
catch error
xhr = error
_xhrErr... | abortTimeout = undefined
window[callbackName] = (response) ->
clearTimeout abortTimeout
$$(script).remove()
delete window[callbackName]
_xhrSuccess response, xhr, settings
script.src = settings.url.replace(RegExp("=\\?"), "=" + ca... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 43 | 86 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:raw_corpus | raw_corpus | $$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xhrForm("DELETE", url, data, success, dataType)
$$.jso... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 88 | 127 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xh... | var _xhrError, _xhrStatus, _xhrSuccess;
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, success, dataType);
};
$$.put = function(url, data, success, dataType) {
return _xhrForm("PUT", url, data, success, dataType);
};
$$.delete = function(url, data, success, dataType) {
re... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 88 | 127 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _xhrError, _xhrStatus, _xhrSuccess;
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, success, dataType);
};
$$.put = function(url, data, success, dataType) {
return _xhrForm("PUT", url, data, success, dataType);
};
$$... | $$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xhrForm("DELETE", url, data, success, dataType)
$$.jso... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 88 | 127 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:completion | completion | $$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xhrForm("DELETE", url, data, success, dataType)
$$.jso... | serialize += "&" if serialize isnt character
serialize += "#{encodeURIComponent parameter}=#{encodeURIComponent parameters[parameter]}"
(if (serialize is character) then "" else serialize)
_xhrStatus = (xhr, settings) ->
if (xhr.status >= 200 and xhr.status < 300) or xhr.status is 0... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 88 | 127 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:raw_corpus | raw_corpus | _xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"] = settings.contentType if settings.contentType
settings.headers["Accept"] = MIME_TYPES[settings.dataType] if settings.dataType
for header of settings.headers
xhr.setRequestHeader header, settings.headers[header]
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 129 | 164 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"] = settings.contentType if settings.contentType
settings.headers["Accept"] = MIME_TYPES[settings.dataType] if settings.dataType
for header of settings.headers
xhr... | var _isJsonP, _parseResponse, _xhrForm, _xhrHeaders, _xhrTimeout;
_xhrHeaders = function(xhr, settings) {
var header;
if (settings.contentType) {
settings.headers["Content-Type"] = settings.contentType;
}
if (settings.dataType) {
settings.headers["Accept"] = MIME_TYPES[settings.dataType];
}
for (he... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 129 | 164 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _isJsonP, _parseResponse, _xhrForm, _xhrHeaders, _xhrTimeout;
_xhrHeaders = function(xhr, settings) {
var header;
if (settings.contentType) {
settings.headers["Content-Type"] = settings.contentType;
}
if (settings.dataType) {
settings.headers["... | _xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"] = settings.contentType if settings.contentType
settings.headers["Accept"] = MIME_TYPES[settings.dataType] if settings.dataType
for header of settings.headers
xhr.setRequestHeader header, settings.headers[header]
... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 129 | 164 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:completion | completion | _xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"] = settings.contentType if settings.contentType
settings.headers["Accept"] = MIME_TYPES[settings.dataType] if settings.dataType
for header of settings.headers
xhr.setRequestHeader header, settings.headers[header]
... | success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
_parseResponse = (xhr, settings) ->
response = xhr.responseText
if response
if settings.dataType is DEFAULT.MIME
try
response = JSON.parse(res... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | be94c69491c80362458f2e85783e2c0ad694703e | 2,055 | https://github.com/soyjavi/QuoJS/blob/be94c69491c80362458f2e85783e2c0ad694703e/src/quo.ajax.coffee | 129 | 164 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:raw_corpus | raw_corpus | $$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xhrForm("DELETE", url, data, success, dataType)
$$.jso... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | cbf6fc008562c76c29029a461d52aac8ed13f332 | 2,055 | https://github.com/soyjavi/QuoJS/blob/cbf6fc008562c76c29029a461d52aac8ed13f332/src/quo.ajax.coffee | 88 | 127 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xh... | var _xhrError, _xhrStatus, _xhrSuccess;
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, success, dataType);
};
$$.put = function(url, data, success, dataType) {
return _xhrForm("PUT", url, data, success, dataType);
};
$$.delete = function(url, data, success, dataType) {
re... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | cbf6fc008562c76c29029a461d52aac8ed13f332 | 2,055 | https://github.com/soyjavi/QuoJS/blob/cbf6fc008562c76c29029a461d52aac8ed13f332/src/quo.ajax.coffee | 88 | 127 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _xhrError, _xhrStatus, _xhrSuccess;
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, success, dataType);
};
$$.put = function(url, data, success, dataType) {
return _xhrForm("PUT", url, data, success, dataType);
};
$$... | $$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xhrForm("DELETE", url, data, success, dataType)
$$.jso... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | cbf6fc008562c76c29029a461d52aac8ed13f332 | 2,055 | https://github.com/soyjavi/QuoJS/blob/cbf6fc008562c76c29029a461d52aac8ed13f332/src/quo.ajax.coffee | 88 | 127 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:completion | completion | $$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xhrForm("DELETE", url, data, success, dataType)
$$.jso... | serialize += "&" if serialize isnt character
serialize += parameter + "=" + parameters[parameter]
(if (serialize is character) then "" else serialize)
_xhrStatus = (xhr, settings) ->
if (xhr.status >= 200 and xhr.status < 300) or xhr.status is 0
if settings.async
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | cbf6fc008562c76c29029a461d52aac8ed13f332 | 2,055 | https://github.com/soyjavi/QuoJS/blob/cbf6fc008562c76c29029a461d52aac8ed13f332/src/quo.ajax.coffee | 88 | 127 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:raw_corpus | raw_corpus | xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr, settings
console.error settings.timeout
if settings.timeout > 0
# xhr.timeout = settings.timeout
# xhr.ontimeout = -> _xhrTimeout xhr, settings
abortTimeout = setTimeout((-> _xhrTimeout xh... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 43 | 83 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:2:completion | completion | xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr, settings
console.error settings.timeout
if settings.timeout > 0
# xhr.timeout = settings.timeout
# xhr.ontimeout = -> _xhrTimeout xhr, settings
abortTimeout = setTimeout((-> _xhrTimeout xh... | callbackName = "jsonp" + (++JSONP_ID)
script = document.createElement("script")
xhr = abort: ->
$$(script).remove()
window[callbackName] = {} if callbackName of window
abortTimeout = undefined
window[callbackName] = (response) ->
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 43 | 83 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:raw_corpus | raw_corpus | $$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 85 | 123 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataTy... | var _xhrStatus;
$$.get = function(url, data, success, dataType) {
return $$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});
};
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, success, dataType);
};
$$.put = function(url, data, success,... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 85 | 123 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _xhrStatus;
$$.get = function(url, data, success, dataType) {
return $$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});
};
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, succes... | $$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 85 | 123 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:completion | completion | $$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
... | data: data
success: success
dataType: DEFAULT.MIME
$$.serializeParameters = (parameters, character="") ->
serialize = character
for parameter of parameters
if parameters.hasOwnProperty(parameter)
serialize += "&" if serialize isnt character
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 85 | 123 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:raw_corpus | raw_corpus | _xhrSuccess = (response, xhr, settings) ->
settings.success.call settings.context, response, xhr
return
_xhrError = (type, xhr, settings) ->
settings.error.call settings.context, type, xhr, settings
return
_xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 125 | 165 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_xhrSuccess = (response, xhr, settings) ->
settings.success.call settings.context, response, xhr
return
_xhrError = (type, xhr, settings) ->
settings.error.call settings.context, type, xhr, settings
return
_xhrHeaders = (... | var _parseResponse, _xhrError, _xhrForm, _xhrHeaders, _xhrSuccess, _xhrTimeout;
_xhrSuccess = function(response, xhr, settings) {
settings.success.call(settings.context, response, xhr);
};
_xhrError = function(type, xhr, settings) {
settings.error.call(settings.context, type, xhr, settings);
};
_xhrHeaders = fun... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 125 | 165 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _parseResponse, _xhrError, _xhrForm, _xhrHeaders, _xhrSuccess, _xhrTimeout;
_xhrSuccess = function(response, xhr, settings) {
settings.success.call(settings.context, response, xhr);
};
_xhrError = function(type, xhr, settings) {
settings.error.call(settin... | _xhrSuccess = (response, xhr, settings) ->
settings.success.call settings.context, response, xhr
return
_xhrError = (type, xhr, settings) ->
settings.error.call settings.context, type, xhr, settings
return
_xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 125 | 165 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:completion | completion | _xhrSuccess = (response, xhr, settings) ->
settings.success.call settings.context, response, xhr
return
_xhrError = (type, xhr, settings) ->
settings.error.call settings.context, type, xhr, settings
return
_xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"... | _xhrForm = (method, url, data, success, dataType) ->
$$.ajax
type: method
url: url
data: data
success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
_parseResponse = (xhr, settings) ->
response = x... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 16ffe8834cfcfd1fac35a01223a91bdc7eaadd33 | 2,055 | https://github.com/soyjavi/QuoJS/blob/16ffe8834cfcfd1fac35a01223a91bdc7eaadd33/src/quo.ajax.coffee | 125 | 165 |
soyjavi/QuoJS:src/quo.ajax.coffee:1:raw_corpus | raw_corpus | ###
QuoJS
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
html: ... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 1 | 39 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:1:completion | completion | ###
QuoJS
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
html: ... | JSONP_ID = 0
$$.ajaxSettings =
type: DEFAULT.TYPE
async: true
success: {}
error: {}
context: null
dataType: DEFAULT.MIME
headers: {}
xhr: -> new window.XMLHttpRequest()
crossDomain: false
timeout: 0
$$.ajax = (options) ->
s... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 1 | 39 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:raw_corpus | raw_corpus | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 41 | 88 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.t... | var abortTimeout, error, xhr;
return $$.jsonp(settings)((function() {
if (_isJsonP(settings.url)) {
xhr = settings.xhr();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
return _xhrStatus(xhr, settings);
}
};
xhr.open(settings.... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 41 | 88 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var abortTimeout, error, xhr;
return $$.jsonp(settings)((function() {
if (_isJsonP(settings.url)) {
xhr = settings.xhr();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
return _xhrStatu... | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 41 | 88 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:completion | completion | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | if settings.async
callbackName = "jsonp" + (++JSONP_ID)
script = document.createElement("script")
xhr = abort: ->
$$(script).remove()
window[callbackName] = {} if callbackName of window
abortTimeout = undefined
window[callba... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 41 | 88 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:raw_corpus | raw_corpus | $$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 90 | 128 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataTy... | var _xhrStatus;
$$.get = function(url, data, success, dataType) {
return $$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});
};
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, success, dataType);
};
$$.put = function(url, data, success,... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 90 | 128 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _xhrStatus;
$$.get = function(url, data, success, dataType) {
return $$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});
};
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, succes... | $$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 90 | 128 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:completion | completion | $$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
... | data: data
success: success
dataType: DEFAULT.MIME
$$.serializeParameters = (parameters, character="") ->
serialize = character
for parameter of parameters
if parameters.hasOwnProperty(parameter)
serialize += "&" if serialize isnt character
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 90 | 128 |
soyjavi/QuoJS:src/quo.ajax.coffee:5:raw_corpus | raw_corpus | _isJsonP = (url) ->
RegExp("=\\?").test url
return
) Quo | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 3742ee4605295dc1823773b55a3ab9f34cdd021a | 2,055 | https://github.com/soyjavi/QuoJS/blob/3742ee4605295dc1823773b55a3ab9f34cdd021a/src/quo.ajax.coffee | 172 | 177 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | a98591c6034c0dc2eac537a766129d1e76c8859b | 2,055 | https://github.com/soyjavi/QuoJS/blob/a98591c6034c0dc2eac537a766129d1e76c8859b/src/quo.ajax.coffee | 1 | 39 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:1:completion | completion | ###
QuoJS 2.2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
... | JSONP_ID = 0
$$.ajaxSettings =
type: DEFAULT.TYPE
async: true
success: {}
error: {}
context: null
dataType: DEFAULT.MIME
headers: {}
xhr: -> new window.XMLHttpRequest()
crossDomain: false
timeout: 0
$$.ajax = (options) ->
s... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | a98591c6034c0dc2eac537a766129d1e76c8859b | 2,055 | https://github.com/soyjavi/QuoJS/blob/a98591c6034c0dc2eac537a766129d1e76c8859b/src/quo.ajax.coffee | 1 | 39 |
soyjavi/QuoJS:src/quo.ajax.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.1.3
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 1 | 39 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:1:completion | completion | ###
QuoJS 2.1.3
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
... | JSONP_ID = 0
$$.ajaxSettings =
type: DEFAULT.TYPE
async: true
success: {}
error: {}
context: null
dataType: DEFAULT.MIME
headers: {}
xhr: -> new window.XMLHttpRequest()
crossDomain: false
timeout: 0
$$.ajax = (options) ->
s... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 1 | 39 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:raw_corpus | raw_corpus | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 41 | 81 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.t... | var abortTimeout, xhr;
return $$.jsonp(settings)(_isJsonP(settings.url) ? (xhr = settings.xhr(), xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
return _xhrStatus(xhr, settings);
}
}, xhr.open(settings.type, settings.url, settings.async), _xhrHeaders(xhr, setti... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 41 | 81 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var abortTimeout, xhr;
return $$.jsonp(settings)(_isJsonP(settings.url) ? (xhr = settings.xhr(), xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
return _xhrStatus(xhr, settings);
}
}, xhr.open(settings.type... | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 41 | 81 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:completion | completion | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | # try
# xhr.send settings.data
# catch error
# xhr = error
# _xhrError "Resource not found", xhr, settings
(if (settings.async) then xhr else _parseResponse(xhr, settings))
$$.jsonp = (settings) ->
if settings.async
callbackName = "jsonp" + (... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 41 | 81 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:raw_corpus | raw_corpus | _xhrSuccess response, xhr, settings
script.src = settings.url.replace(RegExp("=\\?"), "=" + callbackName)
$$("head").append script
if settings.timeout > 0
abortTimeout = setTimeout(->
_xhrTimeout xhr, settings
, settings.timeout)
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 83 | 124 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:3:completion | completion | _xhrSuccess response, xhr, settings
script.src = settings.url.replace(RegExp("=\\?"), "=" + callbackName)
$$("head").append script
if settings.timeout > 0
abortTimeout = setTimeout(->
_xhrTimeout xhr, settings
, settings.timeout)
... | $$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xhrForm("DELETE", url, data, success, dataType)
$$.json = (url, data, success) ->
$$.ajax
url: url
data: data
succ... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 83 | 124 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:raw_corpus | raw_corpus | _xhrStatus = (xhr, settings) ->
if (xhr.status >= 200 and xhr.status < 300) or xhr.status is 0
if settings.async
_xhrSuccess _parseResponse(xhr, settings), xhr, settings
return
else
_xhrError "QuoJS.ajax: Unsuccesful request", xhr, settings
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 126 | 175 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_xhrStatus = (xhr, settings) ->
if (xhr.status >= 200 and xhr.status < 300) or xhr.status is 0
if settings.async
_xhrSuccess _parseResponse(xhr, settings), xhr, settings
return
else
_xhrError... | var _parseResponse, _xhrError, _xhrForm, _xhrHeaders, _xhrStatus, _xhrSuccess, _xhrTimeout;
_xhrStatus = function(xhr, settings) {
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 0) {
if (settings.async) {
_xhrSuccess(_parseResponse(xhr, settings), xhr, settings);
}
} else {
_xhrErr... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 126 | 175 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _parseResponse, _xhrError, _xhrForm, _xhrHeaders, _xhrStatus, _xhrSuccess, _xhrTimeout;
_xhrStatus = function(xhr, settings) {
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 0) {
if (settings.async) {
_xhrSuccess(_parseResponse(xhr, ... | _xhrStatus = (xhr, settings) ->
if (xhr.status >= 200 and xhr.status < 300) or xhr.status is 0
if settings.async
_xhrSuccess _parseResponse(xhr, settings), xhr, settings
return
else
_xhrError "QuoJS.ajax: Unsuccesful request", xhr, settings
... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 126 | 175 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:completion | completion | _xhrStatus = (xhr, settings) ->
if (xhr.status >= 200 and xhr.status < 300) or xhr.status is 0
if settings.async
_xhrSuccess _parseResponse(xhr, settings), xhr, settings
return
else
_xhrError "QuoJS.ajax: Unsuccesful request", xhr, settings
... | xhr.onreadystatechange = {}
xhr.abort()
_xhrError "QuoJS.ajax: Timeout exceeded", xhr, settings
return
_xhrForm = (method, url, data, success, dataType) ->
$$.ajax
type: method
url: url
data: data
success: success
dataType:... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 73b74919bad1766b8f53f331f3feaa5d6e7858e4 | 2,055 | https://github.com/soyjavi/QuoJS/blob/73b74919bad1766b8f53f331f3feaa5d6e7858e4/src/quo.ajax.coffee | 126 | 175 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:raw_corpus | raw_corpus | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b48b3844262d98943a060b0f508dffa039ef4b27 | 2,055 | https://github.com/soyjavi/QuoJS/blob/b48b3844262d98943a060b0f508dffa039ef4b27/src/quo.ajax.coffee | 41 | 80 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.t... | var abortTimeout, error, parameters, xhr;
return $$.jsonp(settings)((function() {
if (_isJsonP(settings.url)) {
xhr = settings.xhr();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
return _xhrStatus(xhr, settings);
}
};
xhr.op... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b48b3844262d98943a060b0f508dffa039ef4b27 | 2,055 | https://github.com/soyjavi/QuoJS/blob/b48b3844262d98943a060b0f508dffa039ef4b27/src/quo.ajax.coffee | 41 | 80 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var abortTimeout, error, parameters, xhr;
return $$.jsonp(settings)((function() {
if (_isJsonP(settings.url)) {
xhr = settings.xhr();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
retu... | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b48b3844262d98943a060b0f508dffa039ef4b27 | 2,055 | https://github.com/soyjavi/QuoJS/blob/b48b3844262d98943a060b0f508dffa039ef4b27/src/quo.ajax.coffee | 41 | 80 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:completion | completion | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | xhr.send settings.data
catch error
xhr = error
_xhrError "Resource not found", xhr, settings
(if (settings.async) then xhr else _parseResponse(xhr, settings))
$$.jsonp = (settings) ->
if settings.async
callbackName = "jsonp" + (++JSONP_ID)
sc... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b48b3844262d98943a060b0f508dffa039ef4b27 | 2,055 | https://github.com/soyjavi/QuoJS/blob/b48b3844262d98943a060b0f508dffa039ef4b27/src/quo.ajax.coffee | 41 | 80 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:raw_corpus | raw_corpus | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 444e48d26db8f22134c6306f1bfa15078a1e4bcc | 2,055 | https://github.com/soyjavi/QuoJS/blob/444e48d26db8f22134c6306f1bfa15078a1e4bcc/src/quo.ajax.coffee | 41 | 79 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.t... | var abortTimeout, error, parameters, xhr;
return $$.jsonp(settings)((function() {
if (_isJsonP(settings.url)) {
xhr = settings.xhr();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
return _xhrStatus(xhr, settings);
}
};
xhr.op... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 444e48d26db8f22134c6306f1bfa15078a1e4bcc | 2,055 | https://github.com/soyjavi/QuoJS/blob/444e48d26db8f22134c6306f1bfa15078a1e4bcc/src/quo.ajax.coffee | 41 | 79 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var abortTimeout, error, parameters, xhr;
return $$.jsonp(settings)((function() {
if (_isJsonP(settings.url)) {
xhr = settings.xhr();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
retu... | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 444e48d26db8f22134c6306f1bfa15078a1e4bcc | 2,055 | https://github.com/soyjavi/QuoJS/blob/444e48d26db8f22134c6306f1bfa15078a1e4bcc/src/quo.ajax.coffee | 41 | 79 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:completion | completion | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | xhr = error
_xhrError "Resource not found", xhr, settings
(if (settings.async) then xhr else _parseResponse(xhr, settings))
$$.jsonp = (settings) ->
if settings.async
callbackName = "jsonp" + (++JSONP_ID)
script = document.createElement("script")
xhr... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 444e48d26db8f22134c6306f1bfa15078a1e4bcc | 2,055 | https://github.com/soyjavi/QuoJS/blob/444e48d26db8f22134c6306f1bfa15078a1e4bcc/src/quo.ajax.coffee | 41 | 79 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:raw_corpus | raw_corpus | script.src = settings.url.replace(RegExp("=\\?"), "=" + callbackName)
$$("head").append script
if settings.timeout > 0
abortTimeout = setTimeout(->
_xhrTimeout xhr, settings
, settings.timeout)
xhr
else
console.e... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 444e48d26db8f22134c6306f1bfa15078a1e4bcc | 2,055 | https://github.com/soyjavi/QuoJS/blob/444e48d26db8f22134c6306f1bfa15078a1e4bcc/src/quo.ajax.coffee | 81 | 120 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:3:completion | completion | script.src = settings.url.replace(RegExp("=\\?"), "=" + callbackName)
$$("head").append script
if settings.timeout > 0
abortTimeout = setTimeout(->
_xhrTimeout xhr, settings
, settings.timeout)
xhr
else
console.e... | $$.put = (url, data, success, dataType) ->
_xhrForm("PUT", url, data, success, dataType)
$$.delete = (url, data, success, dataType) ->
_xhrForm("DELETE", url, data, success, dataType)
$$.json = (url, data, success) ->
$$.ajax
url: url
data: data
succ... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 444e48d26db8f22134c6306f1bfa15078a1e4bcc | 2,055 | https://github.com/soyjavi/QuoJS/blob/444e48d26db8f22134c6306f1bfa15078a1e4bcc/src/quo.ajax.coffee | 81 | 120 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:raw_corpus | raw_corpus | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 420ad8c304b27b1d18cc4622b6373cd742b79982 | 2,055 | https://github.com/soyjavi/QuoJS/blob/420ad8c304b27b1d18cc4622b6373cd742b79982/src/quo.ajax.coffee | 41 | 81 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.t... | var abortTimeout, xhr;
return $$.jsonp(settings)(_isJsonP(settings.url) ? (xhr = settings.xhr(), xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
return _xhrStatus(xhr, settings);
}
}, xhr.open(settings.type, settings.url, settings.async), _xhrHeaders(xhr, setti... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 420ad8c304b27b1d18cc4622b6373cd742b79982 | 2,055 | https://github.com/soyjavi/QuoJS/blob/420ad8c304b27b1d18cc4622b6373cd742b79982/src/quo.ajax.coffee | 41 | 81 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var abortTimeout, xhr;
return $$.jsonp(settings)(_isJsonP(settings.url) ? (xhr = settings.xhr(), xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
clearTimeout(abortTimeout);
return _xhrStatus(xhr, settings);
}
}, xhr.open(settings.type... | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 420ad8c304b27b1d18cc4622b6373cd742b79982 | 2,055 | https://github.com/soyjavi/QuoJS/blob/420ad8c304b27b1d18cc4622b6373cd742b79982/src/quo.ajax.coffee | 41 | 81 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:completion | completion | return $$.jsonp(settings) if _isJsonP(settings.url)
xhr = settings.xhr()
xhr.onreadystatechange = ->
if xhr.readyState is 4
clearTimeout abortTimeout
_xhrStatus xhr, settings
xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr... | xhr = abort: ->
$$(script).remove()
window[callbackName] = {} if callbackName of window
abortTimeout = undefined
window[callbackName] = (response) ->
clearTimeout abortTimeout
$$(script).remove()
delete window[ca... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 420ad8c304b27b1d18cc4622b6373cd742b79982 | 2,055 | https://github.com/soyjavi/QuoJS/blob/420ad8c304b27b1d18cc4622b6373cd742b79982/src/quo.ajax.coffee | 41 | 81 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:raw_corpus | raw_corpus | $$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 27a6117dbd521ad5d555abf20e120556c6000301 | 2,055 | https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.ajax.coffee | 83 | 121 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataTy... | var _xhrStatus;
$$.get = function(url, data, success, dataType) {
return $$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});
};
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, success, dataType);
};
$$.put = function(url, data, success,... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 27a6117dbd521ad5d555abf20e120556c6000301 | 2,055 | https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.ajax.coffee | 83 | 121 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _xhrStatus;
$$.get = function(url, data, success, dataType) {
return $$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});
};
$$.post = function(url, data, success, dataType) {
return _xhrForm("POST", url, data, succes... | $$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 27a6117dbd521ad5d555abf20e120556c6000301 | 2,055 | https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.ajax.coffee | 83 | 121 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:completion | completion | $$.get = (url, data, success, dataType) ->
$$.ajax
url: url
data: data
success: success
dataType: dataType
$$.post = (url, data, success, dataType) ->
_xhrForm("POST", url, data, success, dataType)
$$.put = (url, data, success, dataType) ->
... | data: data
success: success
dataType: DEFAULT.MIME
$$.serializeParameters = (parameters, character="") ->
serialize = character
for parameter of parameters
if parameters.hasOwnProperty(parameter)
serialize += "&" if serialize isnt character
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 27a6117dbd521ad5d555abf20e120556c6000301 | 2,055 | https://github.com/soyjavi/QuoJS/blob/27a6117dbd521ad5d555abf20e120556c6000301/src/quo.ajax.coffee | 83 | 121 |
soyjavi/QuoJS:src/quo.ajax.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.0.3
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 7c9571a29de01f7f691fdc64aadfbfa596c2912c | 2,055 | https://github.com/soyjavi/QuoJS/blob/7c9571a29de01f7f691fdc64aadfbfa596c2912c/src/quo.ajax.coffee | 1 | 39 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:1:completion | completion | ###
QuoJS 2.0.3
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
... | JSONP_ID = 0
$$.ajaxSettings =
type: DEFAULT.TYPE
async: true
success: {}
error: {}
context: null
dataType: DEFAULT.MIME
headers: {}
xhr: -> new window.XMLHttpRequest()
crossDomain: false
timeout: 0
$$.ajax = (options) ->
s... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 7c9571a29de01f7f691fdc64aadfbfa596c2912c | 2,055 | https://github.com/soyjavi/QuoJS/blob/7c9571a29de01f7f691fdc64aadfbfa596c2912c/src/quo.ajax.coffee | 1 | 39 |
soyjavi/QuoJS:src/quo.ajax.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.0.3
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 1 | 40 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:1:completion | completion | ###
QuoJS 2.0.3
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
... | $$.ajaxSettings =
type: DEFAULT.TYPE
async: true
success: {}
error: {}
context: null
dataType: DEFAULT.MIME
headers: {}
xhr: -> new window.XMLHttpRequest()
crossDomain: false
timeout: 0
$$.ajax = (options) ->
settings = $$.mix(... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 1 | 40 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:raw_corpus | raw_corpus | xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr, settings
if settings.timeout > 0
abortTimeout = setTimeout(->
_xhrTimeout xhr, settings
, settings.timeout)
xhr.send settings.data
(if (settings.async) then xhr else _parseRespon... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 42 | 82 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:2:completion | completion | xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr, settings
if settings.timeout > 0
abortTimeout = setTimeout(->
_xhrTimeout xhr, settings
, settings.timeout)
xhr.send settings.data
(if (settings.async) then xhr else _parseRespon... | $$(script).remove()
delete window[callbackName]
_xhrSuccess response, xhr, settings
script.src = settings.url.replace(RegExp("=\\?"), "=" + callbackName)
$$("head").append script
if settings.timeout > 0
abortTimeout = setTimeout(->
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 42 | 82 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:raw_corpus | raw_corpus | $$.post = (url, data, success, dataType) ->
$$.ajax
type: "POST"
url: url
data: data
success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
$$.json = (url, data, success) ->
url += $$.serializePara... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 84 | 123 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$$.post = (url, data, success, dataType) ->
$$.ajax
type: "POST"
url: url
data: data
success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
$$.json ... | var _xhrError, _xhrStatus, _xhrSuccess;
$$.post = function(url, data, success, dataType) {
return $$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType,
contentType: "application/x-www-form-urlencoded"
});
};
$$.json = function(url, data, success) {
url += $$... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 84 | 123 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _xhrError, _xhrStatus, _xhrSuccess;
$$.post = function(url, data, success, dataType) {
return $$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType,
contentType: "application/x-www-form-urlencoded"
});
}... | $$.post = (url, data, success, dataType) ->
$$.ajax
type: "POST"
url: url
data: data
success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
$$.json = (url, data, success) ->
url += $$.serializePara... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 84 | 123 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:completion | completion | $$.post = (url, data, success, dataType) ->
$$.ajax
type: "POST"
url: url
data: data
success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
$$.json = (url, data, success) ->
url += $$.serializePara... | serialize += "&" if serialize isnt "?"
serialize += parameter + "=" + parameters[parameter]
(if (serialize is "?") then "" else serialize)
_xhrStatus = (xhr, settings) ->
if xhr.status is 200 or xhr.status is 0
if settings.async
_xhrSuccess _parseRespo... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 84 | 123 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:raw_corpus | raw_corpus | _xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"] = settings.contentType if settings.contentType
settings.headers["Accept"] = MIME_TYPES[settings.dataType] if settings.dataType
for header of settings.headers
xhr.setRequestHeader header, settings.headers[header]
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 125 | 155 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:4:completion | completion | _xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"] = settings.contentType if settings.contentType
settings.headers["Accept"] = MIME_TYPES[settings.dataType] if settings.dataType
for header of settings.headers
xhr.setRequestHeader header, settings.headers[header]
... | if response
if settings.dataType is DEFAULT.MIME
try
response = JSON.parse(response)
catch error
response = error
_xhrError "QuoJS.ajax: Parse Error", xhr, settings
else response = xhr.responseXML if s... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | 2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c | 2,055 | https://github.com/soyjavi/QuoJS/blob/2c4a33e4e2a6f9b99721999fea5a858c7ee77b0c/src/quo.ajax.coffee | 125 | 155 |
soyjavi/QuoJS:src/quo.ajax.coffee:1:raw_corpus | raw_corpus | ###
QuoJS 2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
ht... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 1 | 40 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:1:completion | completion | ###
QuoJS 2.0
(c) 2011, 2012 Javi Jiménez Villar (@soyjavi)
http://quojs.tapquo.com
###
(($$) ->
DEFAULT =
TYPE: "GET"
MIME: "json"
MIME_TYPES =
script: "text/javascript, application/javascript"
json: "application/json"
xml: "application/xml, text/xml"
ht... | $$.ajaxSettings =
type: DEFAULT.TYPE
async: true
success: {}
error: {}
context: null
dataType: DEFAULT.MIME
headers: {}
xhr: -> new window.XMLHttpRequest()
crossDomain: false
timeout: 0
$$.ajax = (options) ->
settings = $$.mix(... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 1 | 40 |
soyjavi/QuoJS:src/quo.ajax.coffee:2:raw_corpus | raw_corpus | xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr, settings
if settings.timeout > 0
abortTimeout = setTimeout(->
_xhrTimeout xhr, settings
, settings.timeout)
xhr.send settings.data
(if (settings.async) then xhr else _parseRespon... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 42 | 82 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:2:completion | completion | xhr.open settings.type, settings.url, settings.async
_xhrHeaders xhr, settings
if settings.timeout > 0
abortTimeout = setTimeout(->
_xhrTimeout xhr, settings
, settings.timeout)
xhr.send settings.data
(if (settings.async) then xhr else _parseRespon... | $$(script).remove()
delete window[callbackName]
_xhrSuccess response, xhr, settings
script.src = settings.url.replace(RegExp("=\\?"), "=" + callbackName)
$$("head").append script
if settings.timeout > 0
abortTimeout = setTimeout(->
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 42 | 82 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:raw_corpus | raw_corpus | $$.post = (url, data, success, dataType) ->
$$.ajax
type: "POST"
url: url
data: data
success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
$$.json = (url, data, success) ->
url += $$.serializePara... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 84 | 123 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$$.post = (url, data, success, dataType) ->
$$.ajax
type: "POST"
url: url
data: data
success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
$$.json ... | var _xhrError, _xhrStatus, _xhrSuccess;
$$.post = function(url, data, success, dataType) {
return $$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType,
contentType: "application/x-www-form-urlencoded"
});
};
$$.json = function(url, data, success) {
url += $$... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 84 | 123 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _xhrError, _xhrStatus, _xhrSuccess;
$$.post = function(url, data, success, dataType) {
return $$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType,
contentType: "application/x-www-form-urlencoded"
});
}... | $$.post = (url, data, success, dataType) ->
$$.ajax
type: "POST"
url: url
data: data
success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
$$.json = (url, data, success) ->
url += $$.serializePara... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 84 | 123 |
soyjavi/QuoJS:src/quo.ajax.coffee:3:completion | completion | $$.post = (url, data, success, dataType) ->
$$.ajax
type: "POST"
url: url
data: data
success: success
dataType: dataType
contentType: "application/x-www-form-urlencoded"
$$.json = (url, data, success) ->
url += $$.serializePara... | serialize += "&" if serialize isnt "?"
serialize += parameter + "=" + parameters[parameter]
(if (serialize is "?") then "" else serialize)
_xhrStatus = (xhr, settings) ->
if xhr.status is 200 or xhr.status is 0
if settings.async
_xhrSuccess _parseRespo... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 84 | 123 |
soyjavi/QuoJS:src/quo.ajax.coffee:4:raw_corpus | raw_corpus | _xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"] = settings.contentType if settings.contentType
settings.headers["Accept"] = MIME_TYPES[settings.dataType] if settings.dataType
for header of settings.headers
xhr.setRequestHeader header, settings.headers[header]
... | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 125 | 155 | ||
soyjavi/QuoJS:src/quo.ajax.coffee:4:completion | completion | _xhrHeaders = (xhr, settings) ->
settings.headers["Content-Type"] = settings.contentType if settings.contentType
settings.headers["Accept"] = MIME_TYPES[settings.dataType] if settings.dataType
for header of settings.headers
xhr.setRequestHeader header, settings.headers[header]
... | if response
if settings.dataType is DEFAULT.MIME
try
response = JSON.parse(response)
catch error
response = error
_xhrError "Parse Error", xhr, settings
else response = xhr.responseXML if settings.data... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo.ajax.coffee | MIT | b4ba2781f3b6d7b57861b7217260136dbdd7d8eb | 2,055 | https://github.com/soyjavi/QuoJS/blob/b4ba2781f3b6d7b57861b7217260136dbdd7d8eb/src/quo.ajax.coffee | 125 | 155 |
jeremyramin/terminal-plus:spec/terminal-plus-spec.coffee:1:raw_corpus | raw_corpus | TerminalPlus = require '../lib/terminal-plus'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
describe "TerminalPlus", ->
[workspaceElement, activati... | CoffeeScript | jeremyramin/terminal-plus | spec/terminal-plus-spec.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/spec/terminal-plus-spec.coffee | 1 | 50 | ||
jeremyramin/terminal-plus:spec/terminal-plus-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
TerminalPlus = require '../lib/terminal-plus'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
... | var TerminalPlus;
TerminalPlus = require('../lib/terminal-plus');
// Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
// To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
// or `fdescribe`). Remove the `f` to unfocus the block.
describe("TerminalPlus", function()... | CoffeeScript | JavaScript | jeremyramin/terminal-plus | spec/terminal-plus-spec.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/spec/terminal-plus-spec.coffee | 1 | 50 |
jeremyramin/terminal-plus:spec/terminal-plus-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TerminalPlus;
TerminalPlus = require('../lib/terminal-plus');
// Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
// To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
// or `fdescribe`). Remove the `f` to... | TerminalPlus = require '../lib/terminal-plus'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
describe "TerminalPlus", ->
[workspaceElement, activati... | JavaScript | CoffeeScript | jeremyramin/terminal-plus | spec/terminal-plus-spec.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/spec/terminal-plus-spec.coffee | 1 | 50 |
jeremyramin/terminal-plus:spec/terminal-plus-spec.coffee:1:completion | completion | TerminalPlus = require '../lib/terminal-plus'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
describe "TerminalPlus", ->
[workspaceElement, activati... | activationPromise
runs ->
expect(workspaceElement.querySelector('.terminal-plus')).toExist()
terminalPlusElement = workspaceElement.querySelector('.terminal-plus')
expect(terminalPlusElement).toExist()
statusBar = atom.workspace.panelForItem(terminalPlusElement)
expect(s... | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | spec/terminal-plus-spec.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/spec/terminal-plus-spec.coffee | 1 | 50 |
jeremyramin/terminal-plus:spec/terminal-plus-spec.coffee:2:raw_corpus | raw_corpus | # activated.
atom.commands.dispatch workspaceElement, 'terminal-plus:toggle'
waitsForPromise ->
activationPromise
runs ->
# Now we can test for view visibility
terminalPlusElement = workspaceElement.querySelector('.terminal-plus')
expect(terminalPlusElement).toBeVisib... | CoffeeScript | jeremyramin/terminal-plus | spec/terminal-plus-spec.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/spec/terminal-plus-spec.coffee | 51 | 62 | ||
jeremyramin/terminal-plus:spec/terminal-plus-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# activated.
atom.commands.dispatch workspaceElement, 'terminal-plus:toggle'
waitsForPromise ->
activationPromise
runs ->
# Now we can test for view visibility
terminalPlusElement = workspaceElement.querySelector('.term... | // activated.
atom.commands.dispatch(workspaceElement, 'terminal-plus:toggle');
waitsForPromise(function() {
return activationPromise;
});
runs(function() {
var terminalPlusElement;
// Now we can test for view visibility
terminalPlusElement = workspaceElement.querySelector('.terminal-plus');
expect(terminal... | CoffeeScript | JavaScript | jeremyramin/terminal-plus | spec/terminal-plus-spec.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/spec/terminal-plus-spec.coffee | 51 | 62 |
jeremyramin/terminal-plus:spec/terminal-plus-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// activated.
atom.commands.dispatch(workspaceElement, 'terminal-plus:toggle');
waitsForPromise(function() {
return activationPromise;
});
runs(function() {
var terminalPlusElement;
// Now we can test for view visibility
terminalPlusElement = workspaceEle... | # activated.
atom.commands.dispatch workspaceElement, 'terminal-plus:toggle'
waitsForPromise ->
activationPromise
runs ->
# Now we can test for view visibility
terminalPlusElement = workspaceElement.querySelector('.terminal-plus')
expect(terminalPlusElement).toBeVisib... | JavaScript | CoffeeScript | jeremyramin/terminal-plus | spec/terminal-plus-spec.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/spec/terminal-plus-spec.coffee | 51 | 62 |
jeremyramin/terminal-plus:spec/terminal-plus-spec.coffee:2:completion | completion | # activated.
atom.commands.dispatch workspaceElement, 'terminal-plus:toggle'
waitsForPromise ->
activationPromise | runs ->
# Now we can test for view visibility
terminalPlusElement = workspaceElement.querySelector('.terminal-plus')
expect(terminalPlusElement).toBeVisible()
atom.commands.dispatch workspaceElement, 'terminal-plus:toggle'
expect(terminalPlusElement).not.toBeVisible() | CoffeeScript | CoffeeScript | jeremyramin/terminal-plus | spec/terminal-plus-spec.coffee | MIT | 1e555ee3a49902b203134072ff079ae580fdff10 | 478 | https://github.com/jeremyramin/terminal-plus/blob/1e555ee3a49902b203134072ff079ae580fdff10/spec/terminal-plus-spec.coffee | 51 | 62 |
jeremyramin/terminal-plus:spec/terminal-plus-spec.coffee:1:raw_corpus | raw_corpus | TerminalPlus = require '../lib/terminal-plus'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
describe "TerminalPlus", ->
[workspaceElement, activati... | CoffeeScript | jeremyramin/terminal-plus | spec/terminal-plus-spec.coffee | MIT | e9dfeb4ceb8aad183da5d3f64394f275ab17cdee | 478 | https://github.com/jeremyramin/terminal-plus/blob/e9dfeb4ceb8aad183da5d3f64394f275ab17cdee/spec/terminal-plus-spec.coffee | 1 | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.