| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Adds event listeners and populates on-load-div. |
| 6 window.onload = function() { |
| 7 updateOnLoadText('OnLoadText'); |
| 8 }; |
| 9 |
| 10 var updateOnLoadText = function(text) { |
| 11 document.getElementById('on-load-div').innerHTML = text; |
| 12 } |
| 13 |
| 14 var isOnLoadTextVisible = function() { |
| 15 return document.getElementById('on-load-div').innerHTML == 'OnLoadText'; |
| 16 } |
| 17 |
| 18 // Updates the url-to-load div with |text|. This value is later used by the |
| 19 // window.location calls below. |
| 20 var updateUrlToLoadText = function(text) { |
| 21 document.getElementById('url-to-load').innerHTML = text; |
| 22 } |
| 23 |
| 24 // Returns a DOMString representing the URL used as the innerHTML of the |
| 25 // url-to-load div. |
| 26 var getUrl = function() { |
| 27 return document.getElementById('url-to-load').innerHTML; |
| 28 } |
| 29 |
| 30 var locationAssign = function() { |
| 31 updateOnLoadText(''); |
| 32 window.location.assign(getUrl()); |
| 33 } |
| 34 |
| 35 var locationReplace = function() { |
| 36 updateOnLoadText(''); |
| 37 window.location.replace(getUrl()); |
| 38 } |
| 39 |
| 40 var locationReload = function() { |
| 41 updateOnLoadText(''); |
| 42 window.location.reload(); |
| 43 } |
| 44 |
| 45 var setLocationToDOMString = function() { |
| 46 updateOnLoadText(''); |
| 47 window.location = getUrl(); |
| 48 } |
| 49 |
| OLD | NEW |