https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114968
Revision: 114968
Author: catrope
Date: 2012-04-19 18:21:53 +0000 (Thu, 19 Apr 2012)
Log Message:
-----------
1.19wmf1: Update ArticleFeedbackv5 from git (wmf/1.20wmf1)
Modified Paths:
--------------
branches/wmf/1.19wmf1/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
Modified:
branches/wmf/1.19wmf1/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
===================================================================
---
branches/wmf/1.19wmf1/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
2012-04-19 18:11:39 UTC (rev 114967)
+++
branches/wmf/1.19wmf1/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
2012-04-19 18:21:53 UTC (rev 114968)
@@ -578,9 +578,10 @@
/**
* Builds the empty form
*
+ * @param from string from whence came the request
("bottom" or "overlay")
* @return Element the form
*/
- buildForm: function () {
+ buildForm: function ( from ) {
// Start up the block to return
var $block = $( $.articleFeedbackv5.editable ?
$.articleFeedbackv5.currentBucket().templates.editable :
$.articleFeedbackv5.currentBucket().templates.noneditable );
@@ -590,11 +591,10 @@
.attr( 'href', mw.msg(
'articlefeedbackv5-cta1-learn-how-url' ) );
// Fill in the button link
- var track_id = $.articleFeedbackv5.experiment()
+ '-button_click-' +
- ( $.articleFeedbackv5.inDialog ?
'overlay' : 'bottom' );
+ var track_id = $.articleFeedbackv5.experiment()
+ '-button_click-' + from;
if ( $.articleFeedbackv5.editable ) {
$block.find(
'.articleFeedbackv5-cta-button' )
- .attr( 'href',
$.articleFeedbackv5.editUrl( track_id ) );
+ .attr( 'href',
$.articleFeedbackv5.editUrl( track_id, from ) );
} else {
var learn_url = mw.msg(
'articlefeedbackv5-cta1-learn-how-url' );
$block.find(
'.articleFeedbackv5-cta-button' )
@@ -628,6 +628,22 @@
$.articleFeedbackv5.find(
'.articleFeedbackv5-ui' )
.addClass(
'articleFeedbackv5-option-4-noedit' );
}
+ },
+
+ // }}}
+ // {{{ onModalToggle
+
+ /**
+ * Handles any setup that has to be done when the modal
window gets
+ * toggled on or off
+ */
+ onModalToggle: function ( from ) {
+ // Fill in the button link
+ if ( $.articleFeedbackv5.editable ) {
+ var track_id =
$.articleFeedbackv5.experiment() + '-button_click-' + from;
+ $.articleFeedbackv5.find(
'.articleFeedbackv5-cta-button' )
+ .attr( 'href',
$.articleFeedbackv5.editUrl( track_id, from ) );
+ }
}
// }}}
@@ -1882,8 +1898,10 @@
* Builds the edit URL, with tracking if appropriate
*
* @param trackingId string the tracking ID
+ * @param from string from whence came the request ("bottom" or
"overlay"),
+ * since the build process happens before inDialog
gets set
*/
- $.articleFeedbackv5.editUrl = function ( trackingId ) {
+ $.articleFeedbackv5.editUrl = function ( trackingId, from ) {
var params = {
'title': mw.config.get( 'wgPageName' ),
'action': 'edit',
@@ -1896,7 +1914,11 @@
params.articleFeedbackv5_link_id =
$.articleFeedbackv5.submittedLinkId;
params.articleFeedbackv5_f_link_id =
$.articleFeedbackv5.floatingLinkId;
params.articleFeedbackv5_experiment =
$.articleFeedbackv5.experiment();
- params.articleFeedbackv5_location =
$.articleFeedbackv5.inDialog ? 'overlay' : 'bottom';
+ if ( from ) {
+ params.articleFeedbackv5_location = from;
+ } else {
+ params.articleFeedbackv5_location =
$.articleFeedbackv5.inDialog ? 'overlay' : 'bottom';
+ }
}
var url = mw.config.get( 'wgScript' ) + '?' + $.param( params );
if ( trackingId ) {
@@ -2034,7 +2056,7 @@
// Build the form
var bucket = $.articleFeedbackv5.currentBucket();
- var $block = bucket.buildForm();
+ var $block = bucket.buildForm( from );
if ( 'bindEvents' in bucket ) {
bucket.bindEvents( $block );
}
@@ -2690,6 +2712,9 @@
if ( 'cta' == $.articleFeedbackv5.nowShowing ) {
$.articleFeedbackv5.clear();
}
+ if ( 'onModalToggle' in
$.articleFeedbackv5.currentBucket() ) {
+
$.articleFeedbackv5.currentBucket().onModalToggle( 'bottom' );
+ }
}
};
@@ -2708,6 +2733,9 @@
} else {
$.articleFeedbackv5.openAsModal( $link );
}
+ if ( 'onModalToggle' in $.articleFeedbackv5.currentBucket() ) {
+ $.articleFeedbackv5.currentBucket().onModalToggle(
$.articleFeedbackv5.inDialog ? 'overlay' : 'bottom' );
+ }
};
// }}}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs