OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.DialogDelegate} | 7 * @extends {WebInspector.DialogDelegate} |
8 * @param {function(string)} callback | 8 * @param {function(string)} callback |
9 */ | 9 */ |
10 WebInspector.AddSourceMapURLDialog = function(callback) | 10 WebInspector.AddSourceMapURLDialog = function(callback) |
11 { | 11 { |
12 WebInspector.DialogDelegate.call(this); | 12 WebInspector.DialogDelegate.call(this); |
13 this.element.classList.add("go-to-line-dialog"); | 13 this.element.classList.add("go-to-line-dialog"); |
14 this.element.createChild("label").textContent = WebInspector.UIString("Sourc
e map URL: "); | 14 this.element.createChild("label").textContent = WebInspector.UIString("Sourc
e map URL: "); |
15 | 15 |
16 this._input = this.element.createChild("input"); | 16 this._input = this.element.createChild("input"); |
17 this._input.setAttribute("type", "text"); | 17 this._input.setAttribute("type", "text"); |
18 | 18 |
19 this._goButton = this.element.createChild("button"); | 19 this._goButton = this.element.createChild("button"); |
20 this._goButton.textContent = WebInspector.UIString("Go"); | 20 this._goButton.textContent = WebInspector.UIString("Add"); |
21 this._goButton.addEventListener("click", this._onGoClick.bind(this), false); | 21 this._goButton.addEventListener("click", this._onGoClick.bind(this), false); |
22 | 22 |
23 this._callback = callback; | 23 this._callback = callback; |
24 } | 24 } |
25 | 25 |
26 /** | 26 /** |
27 * @param {!Element} element | |
28 * @param {function(string)} callback | 27 * @param {function(string)} callback |
29 */ | 28 */ |
30 WebInspector.AddSourceMapURLDialog.show = function(element, callback) | 29 WebInspector.AddSourceMapURLDialog.show = function(callback) |
31 { | 30 { |
32 WebInspector.Dialog.show(element, new WebInspector.AddSourceMapURLDialog(cal
lback)); | 31 WebInspector.Dialog.show(new WebInspector.AddSourceMapURLDialog(callback)); |
33 } | 32 } |
34 | 33 |
35 WebInspector.AddSourceMapURLDialog.prototype = { | 34 WebInspector.AddSourceMapURLDialog.prototype = { |
36 focus: function() | 35 focus: function() |
37 { | 36 { |
38 WebInspector.setCurrentFocusElement(this._input); | 37 WebInspector.setCurrentFocusElement(this._input); |
39 this._input.select(); | 38 this._input.select(); |
40 }, | 39 }, |
41 | 40 |
42 _onGoClick: function() | 41 _onGoClick: function() |
43 { | 42 { |
44 this._apply(); | 43 this._apply(); |
45 WebInspector.Dialog.hide(); | 44 WebInspector.Dialog.hide(); |
46 }, | 45 }, |
47 | 46 |
48 _apply: function() | 47 _apply: function() |
49 { | 48 { |
50 var value = this._input.value; | 49 var value = this._input.value; |
51 this._callback(value); | 50 this._callback(value); |
52 }, | 51 }, |
53 | 52 |
54 onEnter: function() | 53 onEnter: function() |
55 { | 54 { |
56 this._apply(); | 55 this._apply(); |
57 }, | 56 }, |
58 | 57 |
59 __proto__: WebInspector.DialogDelegate.prototype | 58 __proto__: WebInspector.DialogDelegate.prototype |
60 } | 59 } |
OLD | NEW |