Advertisement
terorama

rssloader / loader.js

Aug 21st, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. /*window.onload=function() {
  4.  
  5.    uploadDiv=document.getElementById('upload');
  6.  
  7.    newap=document.getElementById('new');
  8.    newap.href='#';
  9.    
  10.    
  11.    newap.onclick=function() {
  12.      
  13.       ajax_request('req=queform',uploadDiv);
  14.       return false;
  15.    }
  16.  
  17. }*/
  18. var G_Sending=false;
  19.  
  20. //--------------------------------------------------------
  21. function createHTTP() {
  22.    var r;
  23.    try {r= new XMLHttpRequest() }
  24.    catch(e) {
  25.    try {r=new ActiveXObject('Msxml2.XMLHTTP');}
  26.    catch(e) {r=new ActiveXObject('Microsoft.XMLHTTP')}
  27.    }
  28.    
  29.    return r;
  30. }
  31. //--------------------------------------------------------
  32. function ajax_request(param,el) {
  33.  
  34.    XHR=createHTTP();
  35.    XHR.el=el;
  36.    XHR.onreadystatechange= function() {
  37.     //alert(this.readyState);
  38.       if (this.readyState==4) {
  39.        
  40.          //if (this.status=200) {
  41.             el3=document.getElementById(this.el);
  42.             el3.innerHTML=this.responseText
  43.             //}
  44.         G_Sending=false;   
  45.         }  
  46.       else  if (this.readyState==3) {
  47.          el3=document.getElementById(this.el);
  48.          el3.innerHTML='Waiting...';
  49.       }  
  50.    }
  51.    
  52.    XHR.open('POST','upload3.php',true);
  53.    XHR.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  54.    XHR.send(param);
  55.    
  56.    //XHR.open('GET','upload3.php?'+param,true);
  57.    //XHR.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  58.    //XHR.send(null);
  59.    
  60. }
  61.  
  62. //--------------------------------------------------------
  63.  
  64. //--------------------------------------------------------
  65. function send_form(f) {
  66.    var params='rssname='+f.rssname.value+'&rssquery='+
  67.       encodeURIComponent(f.rssquery.value)+'&req=postform';
  68.      
  69.    //alert(params);
  70.    //alert(f);
  71.    G_Sending=true;
  72.    f.subm.disabled=true;
  73.    ajax_request(params,"status");
  74.    
  75.    setTimeout('refr_list();',100);
  76. }
  77. //--------------------------------------------------------
  78. function refr_list () {
  79.    if (G_Sending) {
  80.       setTimeout('refr_list();',500);
  81.    } else {
  82.       document.forms["goo"].subm.disabled=false;
  83.       ajax_request('req=list',"list");
  84.    }
  85.    
  86. }
  87. //--------------------------------------------------------
  88. function get_rss(rssurl,count,el) {
  89.    var params='req=getrss&rssq='+rssurl+'&count='+count;
  90.    ajax_request(params,el);
  91. }
  92.  
  93. //--------------------------------------------------------
  94. function get_block(blockname, el) {
  95.    var params='req=getblock&bname='+blockname;
  96.    ajax_request(params,el);
  97. }
  98. //--------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement