javascript:(function(){var getLink=function(){var e,r,s=window.getSelection(),v=document.createElement('div');if(!s.toString())return '';r=s.getRangeAt(0);if(r.commonAncestorContainer.nodeType == 3){e=r.commonAncestorContainer.parentNode}else{v.appendChild(r.cloneContents());e=v.getElementsByTagName('a')[0];};return e&&e.href||''};var formatSize=function(h){if(!h||isNaN(h=parseInt(h)))return'неизвестно';var kb=1024,mb=kb*kb,gb=mb*kb,add=' ('+h+' byte)';if(h<kb)return h+' B';if(h<mb)return(h/kb).toFixed(1)+' KiB'+add;if(h<gb)return(h/mb).toFixed(1)+' MiB'+add;return(h/gb).toFixed(1)+' GiB'+add};var formatDate=function(h){return h?new Date(h).toLocaleString():'неизвестно'};var responseTime=function(s){return Math.round((new Date()-s)/100)/10+' сек'};var reqTimeout,url=getLink();if(!/^https?:/i.test(url)){alert(url+'\nПротокол не поддерживается.');return};var start=new Date();try{var req=new XMLHttpRequest();req.setRequestHeader('Access-Control-Allow-Origin','*');req.open('HEAD',url+'?',true);req.onreadystatechange=function(){if(this.status&&this.readyState==4){clearTimeout(reqTimeout);alert('Файл: '+url+'\n\nВремя отклика: '+responseTime(start)+'\n\nРазмер: '+formatSize(this.getResponseHeader('Content-Length'))+'\nДата: '+formatDate(this.getResponseHeader('Last-Modified'))+'\n\nЗаголовки:\nStatus: '+this.status+' '+this.statusText+'\n'+this.getAllResponseHeaders())}};req.send(null);reqTimeout=setTimeout(function(){req.abort()},10000)}catch(e){var callback=('js'+Math.random()).replace('.','n'),ele=document.documentElement.appendChild(document.createElement('script'));window[callback]=function(o){alert(o.ok&&o.headers?'Файл: '+url+'\n\nВремя отклика: '+responseTime(start)+'\n\nРазмер: '+formatSize(o.headers['content-length'])+'\nДата: '+formatDate(o.headers['last-modified'])+'\n\nСтатус: '+o['status_code']+(o.headers['server']?'\nСервер: '+o.headers['server']:'')+(o.headers['content-type']?'\nТип: '+o.headers['content-type']:''):'Информация недоступна.');ele.parentNode.removeChild(ele);delete window[callback]};ele.src='http://json-head.appspot.com/?url='+encodeURIComponent(url)+'&callback='+callback}})() |