mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-11-23 18:56:04 +00:00
* Подавитесь своим Json'ом, Аяксом и кросс-сайтом
This commit is contained in:
parent
efd276deec
commit
d308786127
|
@ -4,6 +4,9 @@ function $ajax_prot(settings){
|
||||||
if (settings['async'] !==undefined){this.async =settings['async'];}
|
if (settings['async'] !==undefined){this.async =settings['async'];}
|
||||||
if (settings['type'] !==undefined){this.type =settings['type'];}
|
if (settings['type'] !==undefined){this.type =settings['type'];}
|
||||||
if (settings['postdata']!==undefined){this.postdata=settings['postdata'];}
|
if (settings['postdata']!==undefined){this.postdata=settings['postdata'];}
|
||||||
|
if (settings['dont_set_content_type']!==undefined){
|
||||||
|
this.dont_set_content_type=settings['dont_set_content_type'];
|
||||||
|
}
|
||||||
|
|
||||||
this.xhr=new XMLHttpRequest();
|
this.xhr=new XMLHttpRequest();
|
||||||
this.xhr.parent =this;
|
this.xhr.parent =this;
|
||||||
|
@ -12,7 +15,9 @@ function $ajax_prot(settings){
|
||||||
this.xhr.error =settings['error'];
|
this.xhr.error =settings['error'];
|
||||||
this.xhr.onreadystatechange=this.change;
|
this.xhr.onreadystatechange=this.change;
|
||||||
this.xhr.open(this.type, this.url, this.async);
|
this.xhr.open(this.type, this.url, this.async);
|
||||||
if (this.type=='POST'){this.xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');}
|
if ((this.type=='POST')&& !this.dont_set_content_type){
|
||||||
|
this.xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
|
}
|
||||||
if (settings.headers!==undefined){
|
if (settings.headers!==undefined){
|
||||||
for (var i=0;i<settings.headers.length;i++){
|
for (var i=0;i<settings.headers.length;i++){
|
||||||
this.xhr.setRequestHeader(settings.headers[i][0], settings.headers[i][1]);
|
this.xhr.setRequestHeader(settings.headers[i][0], settings.headers[i][1]);
|
||||||
|
@ -22,12 +27,13 @@ function $ajax_prot(settings){
|
||||||
}
|
}
|
||||||
|
|
||||||
$ajax_prot.prototype={
|
$ajax_prot.prototype={
|
||||||
version: '0.0.4a',
|
version: '0.0.5a',
|
||||||
url: '',
|
url: '',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
async: true,
|
async: true,
|
||||||
postdata:null,
|
postdata:null,
|
||||||
xhr: null,
|
xhr: null,
|
||||||
|
dont_set_content_type: false,
|
||||||
change:function(){
|
change:function(){
|
||||||
if (this.readyState!==4){return;}
|
if (this.readyState!==4){return;}
|
||||||
if (this.status==200){
|
if (this.status==200){
|
||||||
|
|
|
@ -647,7 +647,9 @@ function create_pleercom_ajax(id){
|
||||||
'url':'https://pleer.com/site_api/files/get_url',
|
'url':'https://pleer.com/site_api/files/get_url',
|
||||||
'type':'post',
|
'type':'post',
|
||||||
'postdata':'action=download&id='+id,
|
'postdata':'action=download&id='+id,
|
||||||
|
'dont_set_content_type':true,
|
||||||
'pleer_id':id,
|
'pleer_id':id,
|
||||||
|
'headers':[['Accept','*'],['Content-Type','application/x-www-form-urlencoded; charset=UTF-8']],
|
||||||
'success': function (a) {
|
'success': function (a) {
|
||||||
var answer = JSON.parse(a);
|
var answer = JSON.parse(a);
|
||||||
var player = document.createElement('audio');
|
var player = document.createElement('audio');
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"http://*.point.im/*",
|
"http://*.point.im/*",
|
||||||
"https://*.point.im/*",
|
"https://*.point.im/*",
|
||||||
|
"https://pleer.com/*",
|
||||||
"storage",
|
"storage",
|
||||||
"notifications",
|
"notifications",
|
||||||
"tabs"
|
"tabs"
|
||||||
|
|
Loading…
Reference in a new issue