Boost informations with greasemonkey

Public

I need to verify if boost (http://drupal.org/project/boost) is enable on a website.
This greasemonkey script (http://en.wikipedia.org/wiki/Greasemonkey) will check the comment generate by boost (ie: <!-- Page cached by Boost @ 2013-02-26 09:58:19, expires @ 2013-02-26 10:58:19, lifetime 1 hour --> ) and display a message in the top of your page with boost information if exist.Save the source in a file (ex : boost.user.js) and add in greasemonkey.

Get raw version
javascript
  1. // ==UserScript==
  2. // @name Drupal Boost
  3. // @namespace
  4. // @description Displays boost
  5. // @include http://*.*/*
  6. // @include https://*.*/*
  7. // @include file://*
  8. // @version 1.0
  9. // @copyright Pierre
  10. // ==/UserScript==
  11. comments=document.evaluate("//comment()",document,null,6,null);
  12. for(var i=0; i<comments.snapshotLength; i++) {
  13. if(comments.snapshotItem(i).data.indexOf('Page cached by Boost')>0){
  14. var boost=comments.snapshotItem(i).data;
  15. var div = document.createElement('div');
  16. div.textContent =boost;
  17. div.setAttribute('style', ' font-size: 12px;font-family: Lucida Console;box-shadow: 3px 3px 5px black;cursor:pointer;position:absolute; left:0; top:0; background:#000; color:#fff; padding:3px; z-index:99999;');
  18. div.addEventListener('click', function(){
  19. this.style.display = 'none';
  20. this.style.height = '0';
  21. this.style.width = '0';
  22.  
  23. div.removeChild(div.childNodes[0]);
  24. }, false);
  25. document.body.insertBefore(div, document.body.firstChild);
  26. }
  27. }