Skip to content

Instantly share code, notes, and snippets.

@m3g4p0p
Created September 29, 2020 11:12
Show Gist options
  • Save m3g4p0p/924a04e22a295f5c4b57da98d196279a to your computer and use it in GitHub Desktop.
Save m3g4p0p/924a04e22a295f5c4b57da98d196279a to your computer and use it in GitHub Desktop.
cache purging bookmarklet
javascript:(function(){!function(e)%7Bvar%20t%3D%7B%7D%3Bfunction%20n(r)%7Bif(t%5Br%5D)return%20t%5Br%5D.exports%3Bvar%20o%3Dt%5Br%5D%3D%7Bi%3Ar%2Cl%3A!1%2Cexports%3A%7B%7D%7D%3Breturn%20e%5Br%5D.call(o.exports%2Co%2Co.exports%2Cn)%2Co.l%3D!0%2Co.exports%7Dn.m%3De%2Cn.c%3Dt%2Cn.d%3Dfunction(e%2Ct%2Cr)%7Bn.o(e%2Ct)%7C%7CObject.defineProperty(e%2Ct%2C%7Benumerable%3A!0%2Cget%3Ar%7D)%7D%2Cn.r%3Dfunction(e)%7B%22undefined%22!%3Dtypeof%20Symbol%26%26Symbol.toStringTag%26%26Object.defineProperty(e%2CSymbol.toStringTag%2C%7Bvalue%3A%22Module%22%7D)%2CObject.defineProperty(e%2C%22__esModule%22%2C%7Bvalue%3A!0%7D)%7D%2Cn.t%3Dfunction(e%2Ct)%7Bif(1%26t%26%26(e%3Dn(e))%2C8%26t)return%20e%3Bif(4%26t%26%26%22object%22%3D%3Dtypeof%20e%26%26e%26%26e.__esModule)return%20e%3Bvar%20r%3DObject.create(null)%3Bif(n.r(r)%2CObject.defineProperty(r%2C%22default%22%2C%7Benumerable%3A!0%2Cvalue%3Ae%7D)%2C2%26t%26%26%22string%22!%3Dtypeof%20e)for(var%20o%20in%20e)n.d(r%2Co%2Cfunction(t)%7Breturn%20e%5Bt%5D%7D.bind(null%2Co))%3Breturn%20r%7D%2Cn.n%3Dfunction(e)%7Bvar%20t%3De%26%26e.__esModule%3Ffunction()%7Breturn%20e.default%7D%3Afunction()%7Breturn%20e%7D%3Breturn%20n.d(t%2C%22a%22%2Ct)%2Ct%7D%2Cn.o%3Dfunction(e%2Ct)%7Breturn%20Object.prototype.hasOwnProperty.call(e%2Ct)%7D%2Cn.p%3D%22%22%2Cn(n.s%3D5)%7D(%7B5%3Afunction(e%2Ct)%7Bconst%20n%3D(e%2Ct%2Cn)%3D%3EArray.from(e.querySelectorAll(%22%23edit-zone%20~%20*%20%22%2Bt)%2Cn)%2Cr%3Ddocument.getElementById(%22emcmaintable%22)%3Fwindow.frames%5B0%5D.document%3Adocument%2Co%3Dn(r%2C%22a%22%2Ce%3D%3Ee.href)%2Ci%3Dn(r%2C%22img%22%2Ce%3D%3Ee.src)%3B((e%2Ct)%3D%3Ee.reduce((e%2C...n)%3D%3Ee.then(()%3D%3Et(...n))%2CPromise.resolve()))(%5B...o%2C...i%5D.filter(e%3D%3Ee.trim()).map(e%3D%3Enew%20URL(e)).filter(e%3D%3Ee.origin%3D%3D%3Dwindow.location.origin).map(e%3D%3Ee.origin%2Be.pathname).filter((e%2Ct%2Cn)%3D%3E!n.slice(0%2Ct).includes(e))%2C(e%2Ct%2Cn)%3D%3E(document.write(%60%3Cp%3E%5Cn%20%20%20%20(%24%7Bt%2B1%7D%2F%24%7Bn.length%7D)%20Purging%5Cn%20%20%20%20%3Ca%20target%3D%22_blank%22%20href%3D%22%24%7Be%7D%22%3E%24%7Be%7D%3C%2Fa%3E%5Cn%20%20%3C%2Fp%3E%60)%2Cfetch(e%2B%22%2F%40%40plone.cachepurging.purge%22).then(e%3D%3E%7Bif(!e.ok)throw%20new%20Error(e.statusText)%3Breturn%20e%7D).then(e%3D%3EPromise.all(%5Be.text()%2Ce.statusText%5D)).then((%5Be%2Ct%5D)%3D%3Edocument.write(%60%5Cn%20%20%20%20%20%20%3Cdetails%3E%5Cn%20%20%20%20%20%20%20%20%3Csummary%20style%3D%22color%3A%20green%3B%22%3E%24%7Bt%7D%3C%2Fsummary%3E%5Cn%20%20%20%20%20%20%20%20%3Cpre%3E%24%7B(e%3D%3EObject.assign(document.createElement(%22div%22)%2C%7BinnerHTML%3Ae%7D).textContent)(e).trim()%7C%7C%22%5Bno%20response%20text%5D%22%7D%3C%2Fpre%3E%5Cn%20%20%20%20%20%20%3C%2Fdetails%3E%5Cn%20%20%20%20%60)).catch(e%3D%3Edocument.write(%60%3Cp%20style%3D%22color%3A%20red%3B%22%3E%24%7Be%7D%3C%2Fp%3E%60)))).then(()%3D%3Edocument.write('%3Cp%20style%3D%22%5Cn%20%20font-weight%3A%20bold%3B%5Cn%20%20margin%3A%202em%3B%5Cn%20%20text-align%3A%20center%3B%5Cn%22%3EDone!%3C%2Fp%3E'))%7D%7D)%3B})();

Plone Cache Purging Bookmarklet

  • Create a new bookmark in your browser
  • Copy / paste the above code to the location field
  • Click bookmark with Plone in the current tab open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment