update.test.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //(c)2017, MIT Style License <browser-update.org/LICENSE.txt>
  2. // this script is loaded when the bar is shown in testing mode.
  3. // shows debug information and a note that the browser may actually not be outdated
  4. "use strict";
  5. var $buo_test_ = function () {
  6. var op = window._buorgres;
  7. var bb = $bu_getBrowser();
  8. var div = document.createElement("div");
  9. div.className = "buorg-test";
  10. var style = '<style>' +
  11. '.buorg-test {position:absolute;width: 220px; top:5px; right:10px; text-align:center; color:#000; background-color: #ff93a8;font-size: 10px; padding:5px;line-height:1;text-align:left;}' +
  12. '.buorg-test-sub {}' +
  13. '.buorg-test div {padding:0;line-height:1;}' +
  14. '</style>';
  15. if (op.style === "bottom")
  16. style += '<style>.buorg-test {top:auto; bottom:5px;} </style>';
  17. if (op.style === "corner")
  18. style += '<style>.buorg-test {top:auto; bottom:-100px;} </style>';
  19. var h = '<div>Browser Notification Debug-Mode (v'+op.jsv+')</div>' + style;
  20. h += '<div class="buorg-test-sub">'
  21. h += "<div>Browser would normally be notified: " + op.notified + "</div>";
  22. if (op.reasons.length>0)
  23. h += "<div><b>Reasons to show</b>: " + op.reasons.join(",") + "</div>";
  24. if (op.hide_reasons.length>0)
  25. h += "<div><b>Reasons to hide</b>: " + op.hide_reasons.join(",") + "</div>"
  26. h += "<div><b>Browser info</b></div>";
  27. h += "<span>is_latest:" + bb.is_latest + "</span>, ";
  28. h += "<span>is_insecure:" + bb.is_insecure + "</span>, ";
  29. h += "<span>other:" + bb.other + "</span>, ";
  30. h += "<span>no_device_update:" + bb.no_device_update + "</span>, ";
  31. h += "<span>cookie set:" + (document.cookie.indexOf("browserupdateorg=pause")>-1) + "</span>";
  32. h += '</div>'
  33. div.innerHTML = h;
  34. div.onclick = function (e) {
  35. e = e || window.event;
  36. if (e.stopPropagation) e.stopPropagation();
  37. else e.cancelBubble = true;
  38. div.parentNode.removeChild(div);
  39. return false;
  40. }
  41. op.div.appendChild(div);
  42. }();