https://code.insistime.com/qiao.util.js
https://github.com/insistime/qiao.util.js
https://www.npmjs.com/package/qiao.util.js
npm install qiao.util.js
- qiao.ajax by reqwest
- qiao.cookie by js-cookie
- qiao.ls by qiao.ls.js
- qiao.qrcode by qrcode
- qiao.ajax, reqwest, https://www.npmjs.com/package/reqwest
- qiao.cookie, js-cookie, https://www.npmjs.com/package/js-cookie
- qiao.ls, qiao.ls.js, https://www.npmjs.com/package/qiao.ls.js
- qiao.qrcode, qrcode, https://www.npmjs.com/package/qrcode
'use strict';
var qiao = require('qiao.util.js');
var test = function(){
qiao.ajax({
url: 'path/to/html'
, method: 'post'
, data: { foo: 'bar', baz: 100 }
, success: function (resp) {
qwery('#content').html(resp)
}
});
qiao.ajax({
url: 'path/to/html'
, method: 'get'
, data: [ { name: 'foo', value: 'bar' }, { name: 'baz', value: 100 } ]
, success: function (resp) {
qwery('#content').html(resp)
}
});
qiao.ajax({
url: 'path/to/json'
, type: 'json'
, method: 'post'
, error: function (err) { }
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
qiao.ajax({
url: 'path/to/json'
, type: 'json'
, method: 'post'
, contentType: 'application/json'
, headers: {
'X-My-Custom-Header': 'SomethingImportant'
}
, error: function (err) { }
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
// Uses XMLHttpRequest2 credentialled requests (cookies, HTTP basic auth) if supported
qiao.ajax({
url: 'path/to/json'
, type: 'json'
, method: 'post'
, contentType: 'application/json'
, crossOrigin: true
, withCredentials: true
, error: function (err) { }
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
qiao.ajax({
url: 'path/to/data.jsonp?callback=?'
, type: 'jsonp'
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
qiao.ajax({
url: 'path/to/data.jsonp?foo=bar'
, type: 'jsonp'
, jsonpCallback: 'foo'
, jsonpCallbackName: 'bar'
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
qiao.ajax({
url: 'path/to/data.jsonp?foo=bar'
, type: 'jsonp'
, jsonpCallback: 'foo'
, success: function (resp) {
qwery('#content').html(resp.content)
}
, complete: function (resp) {
qwery('#hide-this').hide()
}
});
};
test();
'use strict';
var qiao = require('qiao.util.js');
var test = function(){
// set
qiao.cookie('name', 'value');
// get
console.log(qiao.cookie('name'));
// delete
qiao.cookie('name', null);
console.log(qiao.cookie('name'));
};
test();
'use strict';
var qiao = require('qiao.util.js');
var test = function(){
// set
qiao.ls('name', 'value');
// get
console.log(qiao.ls('name'));
// delete
qiao.ls('name', null);
console.log(qiao.ls('name'));
};
test();
'use strict';
var qiao = require('qiao.util.js');
var test = function(){
// need <div id="qrcode" style="width:100px;height:100px;"></div>
// canvas
qiao.qrcode({
id : 'qrcode',
type: 'canvas',
text: 'http://insistime.com/'
});
// img
qiao.qrcode({
id : 'qrcode',
type: 'img',
text: 'http://insistime.com/'
});
// svg
qiao.qrcode({
id : 'qrcode',
type: 'svg',
text: 'http://insistime.com/'
});
};
test();
'use strict';
var qiao = require('qiao.util.js');
var test = function(){
// url http://www.baidu.com?q=1
var s = qiao.search('q');
// s = 1
console.log(s);
};
test();
- add qiao.ls.js
- update npms
- add file type
- add vendor
- https homepage
- modify readme.md
- add qrcode keyword
- qiao.qrcode
- qiao.search
- modify md
- qiao.ajax
- init project
- qiao.cookie