Index: trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js |
— | — | @@ -12,9 +12,7 @@ |
13 | 13 | focused = false, |
14 | 14 | u = MobileFrontend.utils; |
15 | 15 | |
16 | | - if ( scriptPath ) { |
17 | | - apiUrl = scriptPath + apiUrl; |
18 | | - } |
| 16 | + apiUrl = MobileFrontend.setting( 'scriptPath' ) + apiUrl; |
19 | 17 | |
20 | 18 | function hideResults() { |
21 | 19 | results.style.display = 'none'; |
Index: trunk/extensions/MobileFrontend/javascripts/application.js |
— | — | @@ -99,9 +99,12 @@ |
100 | 100 | init(); |
101 | 101 | return { |
102 | 102 | init: init, |
103 | | - message: function(name) { |
104 | | - return locale[ name ]; |
| 103 | + message: function( name ) { |
| 104 | + return mwMobileFrontendConfig.messages[name] || ''; |
105 | 105 | }, |
| 106 | + setting: function( name ) { |
| 107 | + return mwMobileFrontendConfig.settings[name] || ''; |
| 108 | + }, |
106 | 109 | utils: utilities |
107 | 110 | }; |
108 | 111 | |
Index: trunk/extensions/MobileFrontend/javascripts/opensearch.js |
— | — | @@ -8,9 +8,7 @@ |
9 | 9 | sb = document.getElementById( 'searchbox' ), |
10 | 10 | u = MobileFrontend.utils; |
11 | 11 | |
12 | | - if ( scriptPath ) { |
13 | | - apiUrl = scriptPath + apiUrl; |
14 | | - } |
| 12 | + apiUrl = MobileFrontend.setting( 'scriptPath' ) + apiUrl; |
15 | 13 | |
16 | 14 | function hideResults() { |
17 | 15 | var results = document.getElementById( 'results' ); |
Index: trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php |
— | — | @@ -43,6 +43,16 @@ |
44 | 44 | $buttonHideText = Xml::escapeJsString( $this->data['hideText'] ); |
45 | 45 | $buttonShowText = Xml::escapeJsString( $this->data['showText'] ); |
46 | 46 | |
| 47 | + $jsconfig = array( |
| 48 | + 'messages' => array( |
| 49 | + 'expand-section' => $buttonShowText, |
| 50 | + 'collapse-section' => $buttonHideText |
| 51 | + ), |
| 52 | + 'settings' => array( |
| 53 | + 'scriptPath' => ( $this->data['wgScriptPath'] ), |
| 54 | + ), |
| 55 | + ); |
| 56 | + $configuration = FormatJSON::encode( $jsconfig ); |
47 | 57 | |
48 | 58 | $applicationHtml = <<<HTML |
49 | 59 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
— | — | @@ -57,15 +67,8 @@ |
58 | 68 | <meta name="viewport" content="initial-scale=1.0"> |
59 | 69 | {$appleTouchIconTag} |
60 | 70 | {$jQueryScript} |
61 | | - <script type='text/javascript'> |
62 | | - //<![CDATA[ |
63 | | - var title = "{$this->data['htmlTitle']}"; |
64 | | - var scriptPath = "{$this->data['wgScriptPath']}"; |
65 | | - var locale = { |
66 | | - "expand-section": "{$buttonShowText}", |
67 | | - "collapse-section": "{$buttonHideText}" |
68 | | - }; |
69 | | - //]]> |
| 71 | + <script type="text/javascript"> |
| 72 | + var mwMobileFrontendConfig = {$configuration}; |
70 | 73 | </script> |
71 | 74 | </head> |
72 | 75 | <body> |