跳转到内容

User:Taiwania Justo/沙盒/MediaWiki:DRN-wizard.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// <nowiki>
// 2020-03-09 - 「deconverted from Gadget」只在一個頁面上使用,現在直接從 [[Wikipedia:爭議解決布告板/請求]] 進行呼叫。
const { conv, convByVar } = require( 'ext.gadget.HanAssist' );
/**
 * This is the main object that holds the state for everything
 */
function drw() {

	//Keep track of what step we are on
	this.wizard_step = 0;

	//Has the admin attempted to resolve this on the talk page
	this.talkpage = false;

	//Title of Article
	this.article_title = '';

	//Description of dispute
	this.dispute_description = '';

	//Involved users
	this.involved_users = [mw.config.get( 'wgUserName' )];

	//Previous forums
	this.previous_forums = '';

	//Desired Outcome
	this.desired_outcome = '';

	//Page where the report will be posted
	this.post_link = '';

	// Draw text box
	this.drawTitleInput = function() {
		//Appends to $( '#drwContent1' )

		$( '#drwContent1' ).append( '<h3>' + conv( { hant: '發生編輯爭議的頁面', hans: '发生编辑争议的页面' } ) + '</h3>' );
		$( '#drwContent1' ).append( '<p>'
			+ conv( {
				hant: '請提供發生編輯爭議的條目或頁面的名稱。',
				hans: '请提供发生编辑争议的条目或页面的名称。'
				
			} ) + '<br>'
			+ conv( {
				hant: '例如,如果爭議在「<nowiki>澳大利亚</nowiki>」條目,則請輸入「<b><nowiki>澳大利亚</nowiki></b>」,而非<nowiki>[[澳大利亚]]</nowiki>或「<nowiki/>https://wiki.zwnes.eu.org/wiki/澳大利亚<nowiki/>」。請注意標題繁簡。',
				hans: '例如,如果争议在「<nowiki>澳大利亚</nowiki>」条目,则请输入「<b><nowiki>澳大利亚</nowiki></b>」,而非<nowiki>[[澳大利亚]]</nowiki>或「<nowiki/>https://wiki.zwnes.eu.org/wiki/澳大利亚<nowiki/>」。请注意标题简繁。'
			} ) + '</p>'
		);

		var inputbox = $( document.createElement( 'input' ) );
		inputbox.attr( {
			type: 'text',
			name: 'article_title',
			value: this.article_title
		} );

		inputbox.change( function() {
			gDRW.article_title = this.value.replace( 'https://', 'http://' ).replace( 'http://wiki.zwnes.eu.org/wiki/', '' ).replace( '_', ' ' ).replace( '[[', '' ).replace( ']]', '' );
		} );

		$( '#drwContent1' ).append( inputbox );
	};

	// Draw description textarea
	this.drawDescriptionInput = function() {
		//Appends to $( '#drwContent1' )

		$( '#drwContent1' ).append( '<h3>' + conv( { hant: '爭議概況', hans: '争议概况' } ) + '</h3>' );
		$( '#drwContent1' ).append( '<p>'
			+ conv( {
				hant: '是什麼爭議需要協助調解?請略述爭議的情況(包括緣由及各方的編輯行為)。',
				hans: '是什么争议需要协助调解?请略述争议的情况(包括缘由及各方的编辑行为)。'
				
			} ) + '</p>' );

		var desc = $( document.createElement( 'textarea' ) );
		desc.attr( {
			rows: 6,
			cols: 60,
			maxlength: 500
		} );
		desc.text( this.dispute_description );

		desc.change( function() {
			gDRW.dispute_description = this.value;
		} );
		desc.on( 'keyup', function() {
			$( '#taCount' ).text( '' + this.value.length + ' / 500' );
		} );

		$( '#drwContent1' ).append( desc );

		$( '#drwContent1' ).append( $( '<p id="taCount">' + this.dispute_description.length + ' / 500</p>' ) );
	};

	// Involved users
	this.drawUserInput = function() {
		//Appends to $( '#drwContent1' )

		$( '#drwContent1' ).append( '<h3>' + conv( { hk: '涉事用戶', tw: '涉事使用者', hans: '涉事用户' } ) + '</h3>' );
		$( '#drwContent1' ).append( '<p>'
			+ conv( {
				hk: '這次爭議還涉及哪些用戶?請在下方鍵入用戶名(不帶「User:」前綴),並以半形逗號(,)分列。請謹記通知他們參與此討論。',
				tw: '這次爭議還涉及哪些使用者?請在下方鍵入使用者名稱(不帶「User:」前綴),並以半形逗號(,)分列。請謹記通知他們參與此討論。',
				hans: '这次争议还涉及哪些用户?请在下方键入用户名(不带「User:」前缀),并以半形逗号(,)分列。请谨记通知他们参与此讨论。'
				
			} ) + '</p>' );

		var inputbox = $( document.createElement( 'input' ) );
		inputbox.attr( {
			type: 'text',
			name: 'involved_users',
			value: this.involved_users.join( ', ' )
		} );

		inputbox.change( function() {
			gDRW.involved_users = this.value.split( /,,/g ).map( function ( involved_user ) { return involved_user.trim(); } );
		} );

		$( '#drwContent1' ).append( inputbox );
	};

	// Draw previous forums
	this.drawPreviousInput = function() {
		//Appends to $( '#drwContent1' )

		$( '#drwContent1' ).append( '<h3>解決爭議</h3>' );
		$( '#drwContent1' ).append( '<p>到目前為止,您已經嘗試過哪些步驟來解決這個爭議?請提供這些討論的連結,使用逗號或換行分隔。例如:<br>' );
		$( '#drwContent1' ).append('<ul>' +
		'<li><nowiki>[[Talk:澳大利亞#從資訊框移除高等法院院長]]</li>' +
		'<li><nowiki>[https://wiki.zwnes.eu.org/wiki/Talk:澳大利亞#從資訊框移除高等法院院長 Talk:澳大利亞]</li>' +
		'</ul>' );+
		$( '#drwContent1' ).append( '<u>您至少應在相關條目的討論頁上進行過充分的近期討論。</u><br><font color="red"><b>注意:如果未提供合適的討論連結,您的請求可能會被自動關閉。</b></font></p>' );

		var desc = $( document.createElement( 'textarea' ) );
		desc.attr( {
			rows: 3,
			cols: 60,
			maxlength: 500
		} );
		desc.text( this.previous_forums );

		desc.change( function() {
			gDRW.previous_forums = this.value;
		} );
		desc.on( 'keyup', function() {
			$( '#pcCount' ).text( '' + this.value.length + ' / 500' );
		} );

		$( '#drwContent1' ).append( desc );

		$( '#drwContent1' ).append( $( '<p id="pcCount">' + this.previous_forums.length + ' / 500</p>' ) );
	};

	 // Draw outcome textarea
	this.drawOutcomeInput = function() {
		//Appends to $( '#drwContent1' )

		$( '#drwContent1' ).append( '<p>您覺得我們要如何協助解決這個爭議?</p>' );

		var desc = $( document.createElement( 'textarea' ) );
		desc.attr( {
			rows: 5,
			cols: 60,
			maxlength: 500
		} );
		desc.text( this.desired_outcome );

		desc.change( function() {
			gDRW.desired_outcome = this.value;
		} );
		desc.on( 'keyup', function() {
			$( '#ocCount' ).text( '' + this.value.length + ' / 500' );
		} );

		$( '#drwContent1' ).append( desc );
		$( '#drwContent1' ).append( $( '<p id="ocCount">' + this.desired_outcome.length + ' / 500</p>' ) );
	};

	// Draw the summary content
	this.drawDRWSummary = function() {
		//Appends to $( '#drwContent1' )

		//$( '#drwContent1' ).append( list );

		//Article Title
		$( '#drwContent1' ).append( '<h3>爭議發生地點</h3>' );
		$( '#drwContent1' ).append( $( '<p></p>' ).text( this.article_title ) );

		//Dispute Description
		$( '#drwContent1' ).append( '<h3>爭議概述</h3>' );
		$( '#drwContent1' ).append( $( '<p></p>' ).text( this.dispute_description ) );

		//Users involved
		$( '#drwContent1' ).append( '<h3>涉事用戶</h3>' );
		$( '#drwContent1' ).append( $( '<p></p>' ).text( this.involved_users.join(', ') ) );

		//Previous forums
		$( '#drwContent1' ).append( '<h3>解決爭議</h3>' );
		$( '#drwContent1' ).append( '<h4>爭議解決的先期步驟</h4>' );
		$( '#drwContent1' ).append( $( '<p></p>' ).text( this.previous_forums ) );

		//Desired Outcome
		$( '#drwContent1' ).append( '<h4>您覺得我們要如何協助解決這個爭議?</h4>' );
		$( '#drwContent1' ).append( $( '<p></p>' ).text( this.desired_outcome ) );

	};

	// Generate a WikiText string, representing the report.
	// Returns a string of wikitext
	this.getWikitextReport = function() {
		//Returns string of wikitext for submission to DR page
		var report = "{{DR case status}}\n{{subst:DNAU|28}}<!-- REMEMBER TO REMOVE THE PREVIOUS COMMENT WHEN CLOSING THIS THREAD! -->\n{{drn filing editor|{{subst:REVISIONUSER}}|~~~~~}}\n\n";

		//On Talk Page
		report += "<span style=\"font-size:110%\">'''您是否已在討論頁上針對這個問題進行過討論?'''</span>\n";
		report += '\n' + ( ( this.talkpage ) ? '是的,我已經在討論頁上討論過了。' : '還沒。' ) + '\n\n';

		//Article Title
		report += "<span style=\"font-size:110%\">'''爭議發生地點'''</span>\n";
		var articleArray = this.article_title.split( ',' );
		for ( var articleIndex = 0; articleIndex < articleArray.length; articleIndex++ )
		{
			report += '* {{pagelinks|' + articleArray[ articleIndex ] + '}}\n';
		}
		
		//Involved users
		report += "<span style=\"font-size:110%\">'''涉事用戶'''</span>\n";
		var userIndex;
		for ( userIndex = 0; userIndex < this.involved_users.length; userIndex++ )
		{
			var user = this.involved_users[ userIndex ];
			user = user.trim();
			if ( user ) {
				report += '* {{User|' + user + '}}\n';
			}
		}

		//Dispute Description
		report += "<span style=\"font-size:110%\">'''爭議概述'''</span>\n";
		report += '\n'+ this.dispute_description + '\n\n';

		//Previous forums
		report += "<span style=\"font-size:110%\">'''在提交到這裡之前,您嘗試過哪些方式來解決這個爭議?'''</span>\n";
		report += '\n'+ this.previous_forums + '\n\n';

		//Desired Outcome
		report += "<span style=\"font-size:110%\">'''您覺得我們要如何協助您解決這個爭議?'''</span>\n";
		report += '\n' + this.desired_outcome + '\n\n';

		//User statements
		var currentUser = mw.config.get( 'wgUserName' );
		for ( userIndex = 0; userIndex < this.involved_users.length; userIndex++ ) {
			var user = this.involved_users[ userIndex ];
			if ( user != currentUser ) {
			   report += '====' + user + "的爭議摘要  ====\n<div style=\"font-size:smaller\">請儘量保持簡短—如果可以的話,請控制在2,000字元以內,這樣我們可以更快幫助您。</div>\n\n";
			}
		}

		//Discussion
		report += '=== ' + this.article_title + "的條目討論 ===\n<div style=\"font-size:smaller\">在志工正式開啟案件前,請盡量減少討論。如果有需要,請在條目討論頁繼續進行討論。</div>";

		return report;
	};

	// Returns an html string, representing the progress bar, based on the
	// objects state.
	this.getProgressBar = function() {
		var s1_active = ( this.wizard_step == 1 ) ? ' pr-active' : '';
		var s2_active = ( this.wizard_step == 2 ) ? ' pr-active' : '';
		var s3_active = ( this.wizard_step == 3 ) ? ' pr-active' : '';
	    var s4_active = ( this.wizard_step == 4 ) ? ' pr-active' : '';


		var signupbox = '<ul id="signuptopbox">';
		signupbox += '<li class="s1' + s1_active + '"><span class="pr-number">1</span><span>初步措施</span></li>';
		signupbox += '<li class="pr-spacer' + s1_active + '"><div></div></li>';

		signupbox += '<li class="s2' + s2_active + '"><span class="pr-number">2</span><span>爭議類型</span></li>';
		signupbox += '<li class="pr-spacer' + s2_active + '"><div></div></li>';
		
		signupbox += '<li class="s2' + s3_active + '"><span class="pr-number">3</span><span>描述</span></li>';
		signupbox += '<li class="pr-spacer' + s3_active + '"><div></div></li>';

		signupbox += '<li class="s4' + s4_active + '"><span class="pr-number">4</span><span>總結</span></li>';
		signupbox += '<li class="pr-spacer' + s4_active + '"><div></div></li>';
	
		signupbox += '</ul>';

		return signupbox;
	};

	this.getArticleTitle = function() {
		return this.article_title;
	};

	this.getDisputeDescription = function() {
		return this.dispute_description;
	};

}

/**
 * The various "show...()" functions display each of the 'screens' in the wizard
 */

function showStep1() {

	gDRW.wizard_step = 1;

	$( '#drwProgressBar' ).html( gDRW.getProgressBar() );

	$( '#drwContent1' ).html(
		'<h2>請求爭議解決</h2>' +

		'<p>' +

		'您好,這個表格用於向爭議解決布告板提交請求,這是一個專門解決兩位或多位編輯之間條目內容爭端的平台。' +
		'本表格無法處理主要與用戶行為有關的爭端——這類問題應先與相關用戶討論,如果無法解決,可以<a href="https://wiki.zwnes.eu.org/wiki/WP:ANI">在這裡</a>進行處理。 ' +
		'如果您有任何問題,請向我們的<a href="https://en.wikipedia.org/wiki/WP:DRVOLUNTEERS">志工</a>尋求幫助。' +

		'<h3>簡單來說,當您遇到以下情況時,應該使用爭議解決程序:</h3>' +

		'<ul>' +
		'<li>當您與其他編輯之間有爭議並需要協助解決時。</li>' +
		'<li>願意以冷靜、文明的方式來討論問題。</li>' +
		'<li>願意考慮與其他編輯妥協來解決爭議。</li>' +
		'</ul>' +

		'<h3>這個流程可以:</h3>' +

		'<ul>' +
		'<li>提供內容建議。</li>' +
		'<li>為編輯者提供有關方針和指引的指導。</li>' +
		'<li>調解討論,幫助編輯者朝著達成共識的方向努力。</li>' +
		'<li>提供一個有結構的環境並進行監督,讓編輯者們在有經驗的指導下合作。</li>' +
		'</ul>' +

		'<h3>這個流程無法:</h3>' +

		'<ul>' +
		'<li>禁止其他用戶編輯(無論是全站還是特定頁面)。</li>' +
		'<li>從條目中移除你不喜歡的內容。</li>' +
		'<li>強迫其他編輯者執行某項操作。</li>' +
		'<li>處理已在其他地方討論中的爭端(如<a href="https:/wiki.zwnes.eu.org/wiki/WP:RFC">徵求意見</a>或<a href="https://wiki.zwnes.eu.org/wiki/WP:RFAR">仲裁</a>)。</li>' +

		'</p>' +

		'<p>這個問題是否已經在條目討論頁上進行了充分討論?(如果你不知道什麼是條目討論頁,請回答「還沒」。)</p>'
	);

	var buttons = '<a href="#top" class="button1" id="yesContentClickButton">是,已經討論過了。</a>';
	buttons += ' <a href="#top" class="button1" id="showCancelButton">還沒。</a>';
	$( '#drwButtons' ).html( buttons );

	$( '#yesContentClickButton' ).click( yesContentClick );
	$( '#showCancelButton' ).click( showCancel );
}

function showStep2() {

	gDRW.wizard_step = 2;

	$( '#drwProgressBar' ).html( gDRW.getProgressBar() );

	$( '#drwContent1' ).html(
		'<h2>Types of dispute</h2>' +

		'<p>本論壇專門處理與條目內容相關的問題,無法處理有關其他編輯者行為的問題。這個問題是否僅涉及其他編輯者的行為?</p>'
	);

	var buttons = '<a href="#top" class="button1" id="yesConductClickButton">是的,這是關於另一位用戶的行為問題。</a>';
	buttons += ' <a href="#top" class="button1" id="showContentDisputeForm">不是。</a>';
	$( '#drwButtons' ).html( buttons );

	$( '#yesConductClickButton' ).click( showConductCancel );
	$( '#showContentDisputeForm' ).click( showStep3 );
}

function showStep3( errorMsg ) {

	gDRW.wizard_step = 3;
	$( '#drwProgressBar' ).html( gDRW.getProgressBar() );

	var intro = '';

	if ( typeof errorMsg === 'string' ) {
		intro = '<p class="warning">' + errorMsg + '</p>';
	}

	intro +=
		'<p>' +
		'在這裡簡單描述目前的情況——爭議發生的地點、爭議的內容,以及你希望通過爭議解決獲得的結果。' +
		'(基本上,我們要如何協助您解決這個問題?)' +
		'</p>' +
		'<p>' +
		'為了讓討論更聚焦,請注意字數限制。' +
		'</p>';

	$( '#drwContent1' ).html( intro );

	gDRW.drawTitleInput();

	gDRW.drawDescriptionInput();

	gDRW.drawUserInput();

	gDRW.drawPreviousInput();

	gDRW.drawOutcomeInput();

	var buttons = '<a href="#top" class="button1" id="showStep1Button">上一步</a>';
	buttons += ' <a href="#top" class="button1" id="showCancelButton">取消</a>';
	buttons += ' <a href="#top" class="button1" id="showStep4Button">下一步</a>';

	$( '#drwButtons' ).html( buttons );

	$( '#showStep1Button' ).click( showStep1 );
	$( '#showCancelButton' ).click( showCancel );
	$( '#showStep4Button' ).click( showStep4 );
}

function showStep4() {

	var inputErrors = [];

	//Check that vars were filled
	if ( gDRW.article_title === '' ) {
		inputErrors.push( '爭議發生地點' );
	}
	if ( gDRW.dispute_description === '' ) {
		inputErrors.push( '爭議概述' );
	}
	if ( gDRW.previous_forums === '' ) {
		inputErrors.push( '之前採取的行動' );
	}
	if ( gDRW.desired_outcome === '' ) {
		inputErrors.push( '預期成果' );
	}
	if ( inputErrors.length > 0 ) {
		return showStep3( '所有欄位都需要填寫。尚未填寫的值:' + inputErrors.join( ', ' ) );
	}

	gDRW.wizard_step = 4;
	$( '#drwProgressBar' ).html( gDRW.getProgressBar() );

	$( '#drwContent1' ).html( '<p>這裡是您提供的內容摘要。請快速檢查是否正確,然後提交您的請求,我們將為您提交爭議案件並提供討論的鏈接。</p>' );

	gDRW.drawDRWSummary();


	var buttons = '<a href="#top" class="button1" id="showStep3Button">編輯</a>';
	buttons += ' <a href="#top" class="button1" id="showCancelButton">取消</a>';
	buttons += ' <a href="#top" class="button1" id="doSubmitButton">保存</a>';

	$( '#drwButtons' ).html( buttons );

	$( '#showStep3Button' ).click( showStep3 );
	$( '#showCancelButton' ).click( showCancel );
	$( '#doSubmitButton' ).click( doSubmit );
}

function showResult( status ) {

	$( '#drwProgressBar' ).text( '' );

	if ( status == 'ok' ) {
		//Show thankyou
		$( '#drwContent1' ).html( '<h3>提交成功!</h3><p>感謝您向爭議解決布告板提交請求。</p>' );
		$( '#drwContent1' ).append( $( '<a>請點選這裡來閱覽您的請求。</a>' ).attr( { href: mw.config.get( 'wgArticlePath' ).replace( '$1', gDRW.post_link ) } ) );
		$( '#drwButtons' ).html( '' );
	} else if ( status == 'error' ) {
		//Show error
		$( '#drwContent1' ).html( '<h2>錯誤</h2><p>抱歉,新增您的請求時出現了錯誤。您可以再嘗試一次嗎?</p>' );
		$( '#drwButtons' ).html( '<a href="#top" class="button1" id="showStep4Button">返回摘要</a>' );
		$( '#showStep4Button' ).click( showStep4 );
	} else {
		$( '#drwContent1' ).html( '<h2>錯誤</p><p>發生了一些錯誤!</p>' );
		$( '#drwButtons' ).html( '' );
	}
}

function showCancel() {

	gDRW.wizard_step = 0;
	$( '#drwProgressBar' ).html( gDRW.getProgressBar() );

	$( '#drwContent1' ).html(
		'<p>' +
		'在尋求爭議解決之前,最好先在條目討論頁上與其他用戶討論你的問題。您可以在<a href="https://wiki.zwnes.eu.org/wiki/WP:DISCUSSIT">這個頁面</a>找到相關指導,或者您也可以在<a href="https://wiki.zwnes.eu.org/wiki/Special:MyTalk">您的個人討論頁</a>上放置<code>{{helpme}}</code>,然後會有志工來協助您。' +
		'</p>'
	);
	$( '#drwButtons' ).html( '<a href="#top" class="button1" id="showStep1Button">從頭開始</a>' );
	$( '#showStep1Button' ).click( showStep1 );
}

function showConductCancel() {

	gDRW.wizard_step = 0;
	$( '#drwProgressBar' ).html( gDRW.getProgressBar() );

	$( '#drwContent1' ).html(
		'<p>' +
		'我們只能協助處理內容爭端。如果你對其他編輯者的行為有疑慮,請將問題提交至<a href="https://wiki.zwnes.eu.org/wiki/WP:AN">管理員布告板</a>。' +
		'</p>'
	);
	$( '#drwButtons' ).html( '<a href="#top" class="button1" id="showStep1Button">從頭開始</a>' );
	$( '#showStep1Button' ).click( showStep1 );
}

/**
 * Do the final step of the DRW and post the report to the appropriate page
 */
function doSubmit() {

	//Notify user that we are doing the update
	$( '#drwProgressBar' ).html( '<div style="text-align: center"><img alt="saving report" src="https://upload.wikimedia.org/wikipedia/commons/d/de/Ajax-loader.gif"></img></div>' );
	$( '#drwContent1' ).html( '<p>正在發佈報告......</p>' );

	//Decide on the page to update
	var DRPage = 'Wikipedia:爭議解決布告板'; //The default page to post this

	/**
	 * Decide where to post this dispute resolution report. In the end, DRPage needs to hold
	 * the title of the page where we post the report.
	 *
	 * gDRW.dispute_type is set the short name (index) of the user-selected dispute type
	 * gDRW.previous_forums[ 'xxx' ] will be true if the use ticked the 'xxx' checkbox in the previous forums
	 */

	//Set the post-page on the DRW object
	gDRW.post_link = DRPage + '#' + gDRW.article_title.replace( ' ', '_' );

	//Compose Report
	var report = gDRW.getWikitextReport();

	//Add new section to designated page
	var edittoken = mw.user.tokens.get( 'csrfToken' );

	var date = new Date();
	var dateString = date.toLocaleDateString();
	var summary = gDRW.article_title;

	addNewSection( DRPage, summary, report, edittoken );
}


/**
 * Event handler functions
 */
function setDisputeForum( box ) {
	//alert( 'Setting ' + gDRW.forum_labels[ box.value ] + ' to true' );
	gDRW.previous_forums[ box.value ] = box.checked;

	var linkboxid = 'link_' + box.value;

	if ( box.checked ) {
		$( '#' + linkboxid ).show();
	} else {
		$( '#' + linkboxid ).hide();
	}
}

function updateLink( box ) {
	gDRW.forum_links[ box.name ] = box.value;
}

function yesContentClick() {
	gDRW.talkpage = true;
	showStep2();
}

/**
 * Taken almost verbatim from https://www.mediawiki.org/wiki/API:Edit
 */
function addNewSection( pagetitle, summary, content, editToken ) {
	$.ajax( {
		url: mw.util.wikiScript( 'api' ),
		data: {
			format: 'json',
			action: 'edit',
			title: pagetitle,
			section: 'new',
			summary: summary,
			text: content,
			token: editToken
		},
		dataType: 'json',
		type: 'POST',
		success: function( data ) {
			if ( data && data.edit && data.edit.result == 'Success' ) {
				//window.location.reload(); // reload page if edit was successful
				showResult( 'ok' );
			} else if ( data && data.error ) {
				alert( 'Error: API returned error code "' + data.error.code + '": ' + data.error.info );
				showResult( 'error' );
			} else {
				alert( 'Error: Unknown result from API.' );
				showResult( 'error2' );
			}
		},
		error: function( xhr ) {
			alert( 'Error: Request failed.' );
		}
	} );
}


/**
 * Initialization function. Test if we should place the DRW on the current page.
 * Looks for a <div id="myDRW"></div> on the page.
 */

function runDRW() {

	if ( $( '#myDRW' ).length ){

		//importStylesheet( 'MediaWiki:Gadget-DRN-wizard.css' ); //CSS Styles for the DRW

		//Setup the App's workspace
		$( '#myDRW' ).html( '' );
		$( '#myDRW' ).append( $( '<div id="drw_main" style="height: 100%; width: 1000px; border : 2px black solid;"></div>' ) );
		$( '#drw_main' ).append( '<div id="drwProgressBar" style="width: 950px; padding: 20px 25px; height: 30px; text-align: center"></div>' );
		$( '#drw_main' ).append( '<div id="drwContent1" style="width: 900px; padding: 25px 50px"></div>' );
		$( '#drw_main' ).append( '<div id="drwButtons" style="width: 900px; padding: 10px 50px; text-align: center"></div>' );

		showStep1(); //Show the first page
	}
}


var gDRW = new drw();

$( document ).ready( runDRW );
// JavaScript Document

// </nowiki>