bookmarklet: clear cache
Букмарклет для сброса кэша
by Vladimir Rodkin
HTML
<button type="button" onclick="clearCache();">clear cache</button>
JavaScript
clearCache = function(){
l=function(){
setTimeout(function(){
var a=window.frames['fcc'].location.pathname.split('/');
if(a[a.length-2]=='newhtml.html'){
f.style.display='none';
m.setAttribute('style',lol+'background:#093;border:1px solid #093;color:#FFF');
d.innerHTML='Success!';
window.location.reload();
console.log('Success!');
}else{
f.style.display='block';
m.setAttribute('style',lol+'background:#C00;border:1px solid #C00;color:#FFF');
d.innerHTML='Authorization...';
console.log('Authorization...');
}
},100);
};
var lol='position:fixed;z-index:9999;top:9px;left:50%;margin-left:-128px;width:256px;box-shadow:0 2px 4px rgba(0,0,0,0.2);border-radius:2px;text-align:center;font:14px/25px sans-serif;overflow:hidden;';
if(!document.getElementById('mcc')){
var m=document.createElement('div');
var f=document.createElement('iframe');
var d=document.createElement('div');
m.setAttribute('style',lol+'background:#F9EDBE;border:1px solid #F0C36D;color:#000');
m.setAttribute('id','mcc');
f.setAttribute('name','fcc');
f.setAttribute('id','fcc');
f.setAttribute('onLoad','l();');
f.setAttribute('src','newhtml1.html/');
f.setAttribute('style','display:none;border:none;height:290px;width:100%');
d.setAttribute('style','cursor:pointer');
d.setAttribute('onclick','document.getElementById(\'mcc\').style.display=\'none\';return false');
d.innerHTML='Clearing Cache...';
m.appendChild(d);
m.appendChild(f);
document.body.appendChild(m);
console.log('Create block');
}else{
var m=document.getElementById('mcc');
var d=m.getElementsByTagName('div')[0];
var...