r96822 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96821‎ | r96822 | r96823 >
Date:00:12, 12 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
split up js file
Modified paths:
  • /trunk/extensions/Survey/Survey.php (modified) (history)
  • /trunk/extensions/Survey/resources/ext.survey.answerSelector.js (added) (history)
  • /trunk/extensions/Survey/resources/ext.survey.special.survey.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/Survey.php
@@ -133,6 +133,7 @@
134134
135135 $wgResourceModules['ext.survey.special.survey'] = $moduleTemplate + array(
136136 'scripts' => array(
 137+ 'ext.survey.answerSelector.js',
137138 'ext.survey.special.survey.js'
138139 ),
139140 'styles' => array(
Index: trunk/extensions/Survey/resources/ext.survey.special.survey.js
@@ -6,54 +6,6 @@
77 * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
88 */
99
10 -(function( $, mw, survey ) {
11 -
12 - survey.answerSelector = function( options ) {
13 - var _this = this;
14 -
15 - var defaults = {
16 - 'visible': true,
17 - 'answers': []
18 - };
19 -
20 - options = $.extend( defaults, options );
21 -
22 - this.$div = $( '<div />' ).html( '' );
23 -
24 - this.$div.append( $( '<p />' ).text( mw.msg( 'survey-special-label-answers' ) ) );
25 -
26 - this.$div.append( $( '<textarea />' ).attr( options.attr ).val( options.answers.join( '\n' ) ) );
27 -
28 - this.setVisible( options.visible );
29 - };
30 -
31 - survey.answerSelector.prototype = {
32 -
33 - getHtml: function() {
34 - return this.$div;
35 - },
36 -
37 - show: function() {
38 - this.$div.show();
39 - },
40 -
41 - hide: function() {
42 - this.$div.hide();
43 - },
44 -
45 - setVisible: function( visible ) {
46 - if ( visible ) {
47 - this.show();
48 - }
49 - else {
50 - this.hide();
51 - }
52 - }
53 -
54 - };
55 -
56 -} )( jQuery, window.mediaWiki, window.survey );
57 -
5810 (function( $, mw, survey ) { $( document ).ready( function() {
5911
6012 var _this = this;
Index: trunk/extensions/Survey/resources/ext.survey.answerSelector.js
@@ -0,0 +1,55 @@
 2+/**
 3+ * JavasSript for the Survey MediaWiki extension.
 4+ * @see https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Extension:Survey
 5+ *
 6+ * @licence GNU GPL v3 or later
 7+ * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
 8+ */
 9+
 10+(function( $, mw, survey ) {
 11+
 12+ survey.answerSelector = function( options ) {
 13+ var _this = this;
 14+
 15+ var defaults = {
 16+ 'visible': true,
 17+ 'answers': []
 18+ };
 19+
 20+ options = $.extend( defaults, options );
 21+
 22+ this.$div = $( '<div />' ).html( '' );
 23+
 24+ this.$div.append( $( '<p />' ).text( mw.msg( 'survey-special-label-answers' ) ) );
 25+
 26+ this.$div.append( $( '<textarea />' ).attr( options.attr ).val( options.answers.join( '\n' ) ) );
 27+
 28+ this.setVisible( options.visible );
 29+ };
 30+
 31+ survey.answerSelector.prototype = {
 32+
 33+ getHtml: function() {
 34+ return this.$div;
 35+ },
 36+
 37+ show: function() {
 38+ this.$div.show();
 39+ },
 40+
 41+ hide: function() {
 42+ this.$div.hide();
 43+ },
 44+
 45+ setVisible: function( visible ) {
 46+ if ( visible ) {
 47+ this.show();
 48+ }
 49+ else {
 50+ this.hide();
 51+ }
 52+ }
 53+
 54+ };
 55+
 56+} )( jQuery, window.mediaWiki, window.survey );
Property changes on: trunk/extensions/Survey/resources/ext.survey.answerSelector.js
___________________________________________________________________
Added: svn:eol-style
157 + native

Status & tagging log