Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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 /* | |
| 6 * Code for the main user-visible status page. | |
| 7 */ | |
| 8 | |
| 9 window.onload = function() { | |
| 10 document.add_new_message.message.focus(); | |
| 11 help_init(); | |
| 12 } | |
| 13 | |
| 14 /* | |
| 15 * Functions for managing the help text. | |
| 16 */ | |
| 17 | |
| 18 function help_init() { | |
| 19 // Set up the help text logic. | |
| 20 // We do not mark these vars as local so we can use them later on. | |
|
cmp
2013/11/10 16:31:06
That is an unnecessary optimization. We should ma
vapier
2013/11/10 20:49:05
Done.
| |
| 21 message = document.getElementsByName('message')[0]; | |
| 22 message.onmouseover = help_show; | |
| 23 message.onmousemove = help_show; | |
| 24 message.onmouseout = help_hide; | |
| 25 message.onkeypress = auto_submit; | |
| 26 | |
| 27 help = document.getElementById('help'); | |
| 28 help.onmouseover = help_show; | |
| 29 help.onmouseout = help_hide; | |
|
cmp
2013/11/10 16:31:06
Consistency: if we call help_show onmousemove for
vapier
2013/11/10 20:49:05
i set it on message because the message text box c
| |
| 30 } | |
| 31 | |
| 32 function help_show() { | |
| 33 help.style.left = message.offsetLeft + 'px'; | |
| 34 help.style.top = message.offsetTop + message.offsetHeight + 'px'; | |
| 35 help.style.display = 'inline-block'; | |
|
cmp
2013/11/10 16:31:06
http://www.whatwg.org/specs/web-apps/current-work/
vapier
2013/11/10 20:49:05
you can't use .hidden and .style.display at the sa
| |
| 36 } | |
| 37 | |
| 38 function help_hide() { | |
| 39 help.style.display = 'none'; | |
|
cmp
2013/11/10 16:31:06
http://www.whatwg.org/specs/web-apps/current-work/
| |
| 40 } | |
| 41 | |
| 42 /* | |
| 43 * Misc functions. | |
| 44 */ | |
| 45 | |
| 46 // Used by the status field. | |
| 47 function auto_submit(e) { | |
|
cmp
2013/11/10 16:31:06
I think it's better to stick to the current behavi
vapier
2013/11/10 20:49:05
the current behavior allows you to simply hit ente
| |
| 48 if (!e.shiftKey && e.keyCode == 13) { | |
| 49 // Catch the enter key in the textarea. Allow shift+enter to work | |
| 50 // so people editing a lot of text can play around with things. | |
| 51 var form = document.getElementsByName('add_new_message')[0] | |
| 52 form.submit(); | |
| 53 return false; | |
| 54 } | |
| 55 return true; | |
| 56 } | |
| OLD | NEW |