includes/clientside/static/ajax.js
changeset 1246 330f4de4c937
parent 1227 bdac73ed481e
child 1252 e34c23a35dc9
equal deleted inserted replaced
1243:db42b7c50e57 1246:330f4de4c937
  1784 					}
  1784 					}
  1785 				}
  1785 				}
  1786 			}
  1786 			}
  1787 		});
  1787 		});
  1788 }
  1788 }
       
  1789 
       
  1790 window.ajaxVerifyFilePath = function(input)
       
  1791 {
       
  1792 	input._lastkeyup = new Date();
       
  1793 	// 500ms between keyup and trigger
       
  1794 	setTimeout(function()
       
  1795 		{
       
  1796 			var now = new Date();
       
  1797 			if ( input._lastkeyup.getTime() + 499 < now.getTime() )
       
  1798 			{
       
  1799 				// do the ajaxverify
       
  1800 				ajaxVerifyFilePathReal(input);
       
  1801 			}
       
  1802 		}, 500);
       
  1803 }
       
  1804 
       
  1805 window.ajaxVerifyFilePathReal = function(input)
       
  1806 {
       
  1807 	if ( input.nextSibling && input.nextSibling.tagName == 'IMG' )
       
  1808 		input.parentNode.removeChild(input.nextSibling);
       
  1809 	var img = document.createElement('img');
       
  1810 	img.src = cdnPath + '/images/loading.gif';
       
  1811 	img.hspace = '7';
       
  1812 	ajaxPost(makeUrlNS('Admin', 'UploadConfig', 'act=verify_path'), 'path=' + ajaxEscape(input.value), function(ajax)
       
  1813 		{
       
  1814 			if ( ajax.readyState == 4 && ajax.status == 200 )
       
  1815 			{
       
  1816 				img.src = ( ajax.responseText == 'true' ) ? cdnPath + '/images/mini-success.png' : cdnPath + '/images/mini-error.png';
       
  1817 			}
       
  1818 		});
       
  1819 	insertAfter(input.parentNode, img, input);
       
  1820 }