summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Maps/resources/geojson.new.page.js
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2021-10-19 20:24:11 -0300
committerYaco <franco@reevo.org>2021-10-19 20:24:11 -0300
commite3880a1c86acaa3bbd05786ad2f5c586e6511a58 (patch)
treeec77bfc5b69f259a159c95188797bd0dade92357 /www/wiki/extensions/Maps/resources/geojson.new.page.js
parent20ca0685509f8010580d3b45036a64ab48616af1 (diff)
updates Maps to 7.13.0
Diffstat (limited to 'www/wiki/extensions/Maps/resources/geojson.new.page.js')
-rw-r--r--www/wiki/extensions/Maps/resources/geojson.new.page.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/www/wiki/extensions/Maps/resources/geojson.new.page.js b/www/wiki/extensions/Maps/resources/geojson.new.page.js
new file mode 100644
index 00000000..30980a7a
--- /dev/null
+++ b/www/wiki/extensions/Maps/resources/geojson.new.page.js
@@ -0,0 +1,38 @@
+$( document ).ready( function() {
+ function getErrorMessageForFailure(failureReason) {
+ if (failureReason === 'assertuserfailed') {
+ return 'Could not create page because your session expired. The page will be reloaded';
+ }
+
+ return 'Failed to create the page: ' + failureReason;
+ }
+
+ $('#maps-geojson-new').click(
+ function() {
+ $(this).prop('disabled', true);
+ $(this).text(mw.msg('maps-geo-json-create-page-creating'));
+
+ new mw.Api().create(
+ mw.config.get('wgPageName'),
+ {
+ summary: mw.msg('maps-geo-json-create-page-summary')
+ },
+ '{"type": "FeatureCollection", "features": []}'
+ ).then(
+ function(editData) {
+ if (editData.result !== 'Success') {
+ console.log(editData);
+ alert('Failed to create the page');
+ }
+
+ location.reload();
+ }
+ ).fail(
+ function(reason) {
+ alert(getErrorMessageForFailure(reason));
+ location.reload();
+ }
+ );
+ }
+ );
+} );