Index: trunk/extensions/Survey/Survey.php |
— | — | @@ -133,6 +133,7 @@ |
134 | 134 | |
135 | 135 | $wgResourceModules['ext.survey.special.survey'] = $moduleTemplate + array( |
136 | 136 | 'scripts' => array( |
| 137 | + 'ext.survey.answerSelector.js', |
137 | 138 | 'ext.survey.special.survey.js' |
138 | 139 | ), |
139 | 140 | 'styles' => array( |
Index: trunk/extensions/Survey/resources/ext.survey.special.survey.js |
— | — | @@ -6,54 +6,6 @@ |
7 | 7 | * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
8 | 8 | */ |
9 | 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 ); |
57 | | - |
58 | 10 | (function( $, mw, survey ) { $( document ).ready( function() { |
59 | 11 | |
60 | 12 | 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 |
1 | 57 | + native |