User:Awesome Aasim/editrequestor.js

if (!EditRequestor) { var EditRequestor = {} mw.loader.using("jquery.ui", function {		$(document).ready(function { EditRequestor.url = new URL(location); if (mw.config.get('wgAction') == 'edit' && url.searchParams.get('section') == 'new' && url.searchParams.get('preload') == 'Template:Submit an edit request/preload' && !url.searchParams.get("")) { EditRequestor.requestPage = ''; EditRequestor.requestType = ''; var preloadArray = EditRequestor.url.searchParams.getAll('preloadparams[]'); for (var item of preloadArray) { switch (item) { case 'edit fully-protected': EditRequestor.requestType = item; break; case 'edit interface-protected': EditRequestor.requestType = item; break; case 'edit template-protected': EditRequestor.requestType = item; break; case 'edit extended-protected': EditRequestor.requestType = item; break; case 'edit semi-protected': EditRequestor.requestType = item; break; default: EditRequestor.requestPage = item; break; }				}				$(' ').append(' Please make the change that you unambiguously would like to implement.   ').dialog({					'buttons': [{						"text": "Submit",						"click": function {						}					},					{						"text": "Preview",						"click": function {						}					}					]				}); $("#editrequestor-area").text("Loading..."); $.get(mw.config.get('wgScriptPath') + '/api.php', {					'action': 'parse',					'format': 'json',					'prop': 'wikitext',					'page': mw.config.get('wgPageName')				}).done(function(result) {					if (result.error) {						$("#editrequestor-area").text('Error: ' + result.error.info);					} else {						$("#editrequestor-area").text(result.prop.wikitext['*']);						$("#editrequestor-area").prop("disabled", false);					}				}) }		});	}); }