<div>
  <h1 style="color: #CF2F19"><img src="static/title.png" style="vertical-align:middle;" /> Code Review</h1>
  <script type="text/javascript">
    function getHash() {
      var hash = window.location.hash;
      return hash.substring(1); // remove #
    }
    window.onload = function() {
      var hash_arr= getHash().split(",");
      if (hash_arr[0] == 'patch') {
        var elem = document.getElementById("gerrit_body");
        elem.className = elem.className + ' patch';
      }
    };
    window.onhashchange = function() {
      var hash_arr= getHash().split(",");
      var elem = document.getElementById("gerrit_body");
      if (hash_arr[0] == 'patch') {
        elem.className = elem.className + ' patch';
      } else {
        elem.className = elem.className.replace(' patch', '');
      }
    };
    
  </script>
</div>

<div>
  <h1 style="color: #CF2F19"><img src="static/title.png" style="vertical-align:middle;" /> Code Review</h1>
  <script type="text/javascript">
    function getHash() {
      var hash = window.location.hash;
      return hash.substring(1); // remove #
    }

    window.onload = setTimeout(add_patch_tag, 1000)
    window.onhashchange = add_patch_tag

    function add_patch_tag() {
      var hash_arr= getHash().split(",");
      var elem = document.getElementById("gerrit_body");
      if (hash_arr[0] == 'patch') {
        elem.className = elem.className + ' patch';
      } else {
        elem.className = elem.className.replace(' patch', '');
      }
    }
    
  </script>
</div>

Fix patch js hack for Chrome
Fix patch js hack for Chrome

Chrome doesn't handle window.onload in the same way as other browsers, this compensates (and cleans up the JS a little)

Change-Id: If629155a6f305e5079f70db6d4045896fb43b483
