Last modified: 2011-01-05 21:59:07 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T27439, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25439 - Make variable destinations in banners behave like html links
Make variable destinations in banners behave like html links
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
CentralNotice (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Ryan Kaldari
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-06 20:40 UTC by Tomasz Finc
Modified: 2011-01-05 21:59 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Tomasz Finc 2010-10-06 20:40:42 UTC
Currently we the following js to selecr a variable destination page.

function goToDonationPage( mode ) {
 var url = '{{{banner-url-2010}}}?utm_medium=sitenotice&utm_campaign={{{campaign}}}&utm_source={{{banner}}}';
 if ( mode && mode.length ) { 
  url += '_' + mode;
 }
 var targets = String( '{{{targets}}}' ).split(',');
 if ( targets.length ) {
  url += '&' + targets[Math.floor( Math.random() * targets.length )].replace(/^\s+|\s+$/, '');
 }
 window.location = url;
}

While functionally this does what we want it creates a link that is a js function making it not right clickable. If we could run the js on page load, create a link, and then present that link to the user .. we would have a normal html link with all the properties that people are used to.
Comment 1 Nimish Gautam 2010-10-06 20:45:05 UTC
Do we use "mode" in the function? This fixes the issue:

<code>
var rewrite_url = function() {
 var url = '{{{banner-url-2010}}}?utm_medium=sitenotice&utm_campaign={{{campaign}}}&utm_source={{{banner}}}';

 var targets = String( '{{{targets}}' ).split(',');
 if ( targets.length ) {
  url += '&' + targets[Math.floor( Math.random() * targets.length )].replace(/^\s+|\s+$/, '');
 }
 $j(".fundraiser-banner a.variable_lp").attr("href",url);
}
$j(document).ready(rewrite_url);
</code>

Also, in order to invoke this, the link needs to have the class "varialbe_lp" appended to it, so it will look like this <a class="variable_lp">{{{donate-text2}}}</a>
Comment 2 Nimish Gautam 2010-10-08 17:04:43 UTC
Addendum...just to be super-safe, let's have it be this:
<code>
var rewrite_url = function() {
 var url =
'{{{banner-url-2010}}}?utm_medium=sitenotice&utm_campaign={{{campaign}}}&utm_source={{{banner}}}';

 var targets = String( '{{{targets}}' ).split(',');
 if ( targets.length ) {
  url += '&' + targets[Math.floor( Math.random() * targets.length
)].replace(/^\s+|\s+$/, '');
 }
 $j(".fundraiser-banner a.variable_lp").attr("href",url);
}
if($j){
 $j(document).ready(rewrite_url);
}
</code>

and put a default URL into the banner pointing to something sensible, like https://payments.wikimedia.org/index.php/Special:PayflowProGateway
Comment 3 Tomasz Finc 2010-10-14 00:15:21 UTC
I'm re-opening this as our current solution is starting to clutter up our JS. Can we get this into the CN interface?
Comment 4 Ryan Kaldari 2010-10-14 00:47:49 UTC
If we were to implement this in a sane way it would involve added fundraising specific user-interface components to CentralNotice, something we haven't done yet. Is it OK to make CentralNotice that Wikimedia specific?
Comment 5 Ryan Kaldari 2011-01-05 21:59:07 UTC
This has been fixed in all the banners I know about. If we want to add some UI for this, a new bug should be opened.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links