OLD | NEW |
(Empty) | |
| 1 /* Copyright 2016 The Chromium Authors. All Rights Reserved. |
| 2 * |
| 3 * Use of this source code is governed by a BSD-style |
| 4 * license that can be found in the LICENSE file or at |
| 5 * https://developers.google.com/open-source/licenses/bsd |
| 6 */ |
| 7 |
| 8 /** |
| 9 * @fileoverview Simple functions for dismissible on-page help ("cues"). |
| 10 */ |
| 11 |
| 12 /** |
| 13 * Dimisses the cue. This both updates the DOM and hits the server to |
| 14 * record the fact that the user has dismissed it, so that it won't |
| 15 * be shown again. |
| 16 * |
| 17 * If no security token is present, only the DOM is updated and |
| 18 * nothing is recorded on the server. |
| 19 * |
| 20 * @param {string} cueId The identifier of the cue to hide. |
| 21 * @return {boolean} false to cancel any event. |
| 22 */ |
| 23 function CS_dismissCue(cueId) { |
| 24 $('cue').style.display = 'none'; |
| 25 |
| 26 if (CS_env.token) { |
| 27 CS_setCue(cueId); |
| 28 } |
| 29 return false; |
| 30 } |
| 31 |
| 32 /** |
| 33 * Function to communicate with the server to record the fact that the |
| 34 * user has dismissed a cue. This just passes an object through to the |
| 35 * cues servlet as key-value pairs. |
| 36 * |
| 37 * @param {string} cueId The identifier of the cue to hide. |
| 38 */ |
| 39 function CS_setCue(cueId) { |
| 40 var setCueUrl = '/hosting/cues.do'; |
| 41 |
| 42 // Ignore the response, since we can't do anything about failures. |
| 43 CS_doPost(setCueUrl, null, {'cue_id': cueId}); |
| 44 } |
| 45 |
| 46 // Exports |
| 47 _CS_dismissCue = CS_dismissCue; |
OLD | NEW |