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