Difference between revisions 92863 and 116760 on orwiki

/*  _____________________________________________________________________________
 * |                                                                             |
 * |                    === WARNING: GLOBAL GADGET FILE ===                      |
 * |                  Changes to this page affect many users.                    |
 * | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |
 * |_____________________________________________________________________________|
 *
(contracted; show full)				.click( function(e) {
					e.preventDefault();

					var title = $form.find('#wp-th-question-title').val();
					var text = $form.find('#wp-th-question-text').val();

					if ( title && /\s*$/.test(text) ) {
						mw.teahouse.addQuestion( title
, text );
					}
				})
				.end()
				.find('#wp-th-question-text')
					.keypress( function(e) {
						var $textbox = $(this);
						setTimeout( function() {
							if ( (/\s*$/).test($textbox.val()) ) {
								$form.find('#wp-th-question-ask')
									.button( 'option','disabled', false );
							} else {
								$form.find('#wp-th-question-ask')
									.button( 'option','disabled', true );
							}
						}, 0 );
					} );

			$('.wp-teahouse-ask').click(function(e) {
				$form.toggle('fast');
				e.cancelBubble = true; // for IE
				if (e.stopPropagation) {
					e.stopPropagation();
					e.preventDefault();
				}
			});

			$(document).click( function(e) {
				var $target = $(e.target);
				if ( ! $target.is('.wp-teahouse-question-form *') &&
					! $target.is('.wp-teahouse-ask *')
				) {
					$('.wp-teahouse-question-form').fadeOut();
				}
			} );

			$(document).keydown( function(e) {
				if ( e.keyCode == 27 ) {// ESC
					$('.wp-teahouse-question-form').fadeOut();
				}
			});
		} );
	} );
} )(jQuery,mediaWiki);
//</nowiki>