r108776 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108775‎ | r108776 | r108777 >
Date:23:05, 12 January 2012
Author:rsterbin
Status:ok
Tags:aft 
Comment:
Bug fix: make the target: _blank passed in to buildLink() actually add that as an attribute
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -1343,7 +1343,8 @@
13441344 'articlefeedbackv5-bucket5-form-panel-helpimprove-note',
13451345 {
13461346 href: mw.config.get( 'wgArticleFeedbackv5TermsPage' ), // TODO: Make this work
1347 - text: 'articlefeedbackv5-bucket5-form-panel-helpimprove-privacy'
 1347+ text: 'articlefeedbackv5-bucket5-form-panel-helpimprove-privacy',
 1348+ target: '_blank'
13481349 }
13491350 ) );
13501351
@@ -2168,25 +2169,46 @@
21692170 if ( link1 ) {
21702171 full = full.replace(
21712172 /\$1/,
2172 - mw.html.element( 'a', { href: link1.href }, mw.msg( link1.text )
 2173+ mw.html.element( 'a', $.articleFeedbackv5.attribs( link1 ), mw.msg( link1.text )
21732174 ).toString() );
21742175 }
21752176 if ( link2 ) {
21762177 full = full.replace(
21772178 /\$2/,
2178 - mw.html.element( 'a', { href: link2.href }, mw.msg( link2.text )
 2179+ mw.html.element( 'a', $.articleFeedbackv5.attribs( link2 ), mw.msg( link2.text )
21792180 ).toString() );
21802181 }
21812182 if ( link3 ) {
21822183 full = full.replace(
21832184 /\$3/,
2184 - mw.html.element( 'a', { href: link3.href }, mw.msg( link3.text )
 2185+ mw.html.element( 'a', $.articleFeedbackv5.attribs( link3 ), mw.msg( link3.text )
21852186 ).toString() );
21862187 }
21872188 return full;
21882189 };
21892190
21902191 // }}}
 2192+ // {{{ attribs
 2193+
 2194+ /**
 2195+ * Utility method: Set up the attributes for a link (works with
 2196+ * buildLink())
 2197+ *
 2198+ * @param object link the first link, as { href: '#', text: 'click here'.
 2199+ * other-attrib: 'whatever'}
 2200+ * @return object the attributes
 2201+ */
 2202+ $.articleFeedbackv5.attribs = function ( link ) {
 2203+ var attr = {};
 2204+ for ( var k in link ) {
 2205+ if ( 'text' != k ) {
 2206+ attr[k] = link[k];
 2207+ }
 2208+ }
 2209+ return attr;
 2210+ };
 2211+
 2212+ // }}}
21912213 // {{{ enableSubmission
21922214
21932215 /**
@@ -2552,7 +2574,6 @@
25532575 } else {
25542576 msg = mw.msg( data.error );
25552577 }
2556 - aft5_debug( data.error );
25572578 } else {
25582579 msg = { info: mw.msg( 'articlefeedbackv5-error-unknown' ) };
25592580 }

Status & tagging log