OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
14 * its contributors may be used to endorse or promote products derived | 14 * its contributors may be used to endorse or promote products derived |
15 * from this software without specific prior written permission. | 15 * from this software without specific prior written permission. |
16 * | 16 * |
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | |
29 /** | 28 /** |
30 * @return {string} | 29 * @return {string} |
31 */ | 30 */ |
32 WebInspector.platform = function() | 31 WebInspector.platform = function() { |
33 { | 32 if (!WebInspector._platform) |
34 if (!WebInspector._platform) | 33 WebInspector._platform = InspectorFrontendHost.platform(); |
35 WebInspector._platform = InspectorFrontendHost.platform(); | 34 return WebInspector._platform; |
36 return WebInspector._platform; | |
37 }; | 35 }; |
38 | 36 |
39 /** | 37 /** |
40 * @return {boolean} | 38 * @return {boolean} |
41 */ | 39 */ |
42 WebInspector.isMac = function() | 40 WebInspector.isMac = function() { |
43 { | 41 if (typeof WebInspector._isMac === 'undefined') |
44 if (typeof WebInspector._isMac === "undefined") | 42 WebInspector._isMac = WebInspector.platform() === 'mac'; |
45 WebInspector._isMac = WebInspector.platform() === "mac"; | |
46 | 43 |
47 return WebInspector._isMac; | 44 return WebInspector._isMac; |
48 }; | 45 }; |
49 | 46 |
50 /** | 47 /** |
51 * @return {boolean} | 48 * @return {boolean} |
52 */ | 49 */ |
53 WebInspector.isWin = function() | 50 WebInspector.isWin = function() { |
54 { | 51 if (typeof WebInspector._isWin === 'undefined') |
55 if (typeof WebInspector._isWin === "undefined") | 52 WebInspector._isWin = WebInspector.platform() === 'windows'; |
56 WebInspector._isWin = WebInspector.platform() === "windows"; | |
57 | 53 |
58 return WebInspector._isWin; | 54 return WebInspector._isWin; |
59 }; | 55 }; |
60 | 56 |
61 /** | 57 /** |
62 * @return {string} | 58 * @return {string} |
63 */ | 59 */ |
64 WebInspector.fontFamily = function() | 60 WebInspector.fontFamily = function() { |
65 { | 61 if (WebInspector._fontFamily) |
66 if (WebInspector._fontFamily) | |
67 return WebInspector._fontFamily; | |
68 switch (WebInspector.platform()) { | |
69 case "linux": | |
70 WebInspector._fontFamily = "Ubuntu, Arial, sans-serif"; | |
71 break; | |
72 case "mac": | |
73 WebInspector._fontFamily = "'Lucida Grande', sans-serif"; | |
74 break; | |
75 case "windows": | |
76 WebInspector._fontFamily = "'Segoe UI', Tahoma, sans-serif"; | |
77 break; | |
78 } | |
79 return WebInspector._fontFamily; | 62 return WebInspector._fontFamily; |
| 63 switch (WebInspector.platform()) { |
| 64 case 'linux': |
| 65 WebInspector._fontFamily = 'Ubuntu, Arial, sans-serif'; |
| 66 break; |
| 67 case 'mac': |
| 68 WebInspector._fontFamily = '\'Lucida Grande\', sans-serif'; |
| 69 break; |
| 70 case 'windows': |
| 71 WebInspector._fontFamily = '\'Segoe UI\', Tahoma, sans-serif'; |
| 72 break; |
| 73 } |
| 74 return WebInspector._fontFamily; |
80 }; | 75 }; |
81 | 76 |
82 /** | 77 /** |
83 * @return {string} | 78 * @return {string} |
84 */ | 79 */ |
85 WebInspector.monospaceFontFamily = function() | 80 WebInspector.monospaceFontFamily = function() { |
86 { | 81 if (WebInspector._monospaceFontFamily) |
87 if (WebInspector._monospaceFontFamily) | |
88 return WebInspector._monospaceFontFamily; | |
89 switch (WebInspector.platform()) { | |
90 case "linux": | |
91 WebInspector._monospaceFontFamily = "dejavu sans mono, monospace"; | |
92 break; | |
93 case "mac": | |
94 WebInspector._monospaceFontFamily = "Menlo, monospace"; | |
95 break; | |
96 case "windows": | |
97 WebInspector._monospaceFontFamily = "Consolas, monospace"; | |
98 break; | |
99 } | |
100 return WebInspector._monospaceFontFamily; | 82 return WebInspector._monospaceFontFamily; |
| 83 switch (WebInspector.platform()) { |
| 84 case 'linux': |
| 85 WebInspector._monospaceFontFamily = 'dejavu sans mono, monospace'; |
| 86 break; |
| 87 case 'mac': |
| 88 WebInspector._monospaceFontFamily = 'Menlo, monospace'; |
| 89 break; |
| 90 case 'windows': |
| 91 WebInspector._monospaceFontFamily = 'Consolas, monospace'; |
| 92 break; |
| 93 } |
| 94 return WebInspector._monospaceFontFamily; |
101 }; | 95 }; |
OLD | NEW |