Index: trunk/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -1080,11 +1080,9 @@ |
1081 | 1081 | if( typeof options.url == 'undefined' || options.url === false){ |
1082 | 1082 | if(!wgServer || ! wgScriptPath){ |
1083 | 1083 | return js_error('Error: no api url for api request');; |
1084 | | - } |
1085 | | - if (wgServer && wgScript) |
1086 | | - options.url = wgServer + wgScript; |
| 1084 | + } |
1087 | 1085 | //update to api.php (if index.php was in the wgScript path): |
1088 | | - options.url = options.url.replace(/index.php/, 'api.php'); |
| 1086 | + options.url = mwGetLocalApiUrl(); |
1089 | 1087 | } |
1090 | 1088 | if( typeof options.data == 'undefined' ) |
1091 | 1089 | options.data = {}; |
— | — | @@ -1131,6 +1129,13 @@ |
1132 | 1130 | loadExternalJs( req_url ); |
1133 | 1131 | } |
1134 | 1132 | } |
| 1133 | +function mwGetLocalApiUrl(url){ |
| 1134 | + if (wgServer && wgScript){ |
| 1135 | + url = wgServer + wgScript; |
| 1136 | + return url.replace(/index.php/, 'api.php'); |
| 1137 | + } |
| 1138 | + return false; |
| 1139 | +} |
1135 | 1140 | //grab wiki form error for wiki html page proccessing (should be depricated) |
1136 | 1141 | function grabWikiFormError ( result_page ){ |
1137 | 1142 | var res = {}; |