Template:2011FR/Form-section-links: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
Undo revision 17994 by Pcoombe (talk)
do this more cleanly with parameters as JS objects
Line 21: Line 21:
<li><a id="ways-to-give-link" target="_blank" href="https://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Ways_to_Give&basic=true&country=</html>{{{country}}}<html>&language=</html>{{int:lang}}<html>"></html>{{int:donate_interface-otherways-short}}<html></a></li>
<li><a id="ways-to-give-link" target="_blank" href="https://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Ways_to_Give&basic=true&country=</html>{{{country}}}<html>&language=</html>{{int:lang}}<html>"></html>{{int:donate_interface-otherways-short}}<html></a></li>


<li><a id="faq-link" target="_blank" href="https://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=FAQ&basic=true&country=</html>{{{country}}}<html>&language=</html>{{int:lang}}<html>"></html>{{int:donate_interface-faqs}}<html></a></li>
<li><a id="faq-link" target="_blank" href="https://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=FAQ&country=</html>{{{country}}}<html>&language=</html>{{int:lang}}<html>"></html>{{int:donate_interface-faqs}}<html></a></li>


<li>
<li>
Line 31: Line 31:
</li>
</li>


<li><a id="problems-link" target="_blank" href="https://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Problems_donating&country=</html>{{{country}}}<html>&language=</html>{{int:lang}}<html>"></html>{{int:Donate_interface-problemsdonating}}<html></a></li>
<li><a id="problems-link" target="_blank" href="https://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Problems_donating&basic=true&country=</html>{{{country}}}<html>&language=</html>{{int:lang}}<html>"></html>{{int:Donate_interface-problemsdonating}}<html></a></li>
</ul>
</ul>
<script type="text/javascript">
<script type="text/javascript">
function parseParams(url) {
// This piece of script is add to preserve the layout of the page when the user is sent to monthly donation page
// helper function to get querystring parameters as a JS object, nicked from WP popups gadget
var monthlyURL = window.location.href;
var ret={};
var pageCountrySpecific = getQuerystring( 'form-countryspecific' );
if (url.indexOf('?')===-1) { return ret; }
if (pageCountrySpecific == "") {
var s=url.split('?').slice(1).join();
// if on a static page, e.g. from sidebar just use a monthly form and leave everything else as defaults
var t=s.split('&');
// Need to fix this later to pass language, utm data etc, but that stupid ampersand bug is stopping me for now -- Pcoombe
for (var i=0; i<t.length; ++i) {
monthlyURL = 'https://donate.wikimedia.org/wiki/Special:FundraiserLandingPage?form-countryspecific=Form-countryspecific-monthly<html>';
var z=t[i].split('=');
} else {
z.push(null);
// if on Special:FundraiserLandingPage, use all the same querystring but a monthly form
ret[z[0]]=z[1];
monthlyURL = monthlyURL.replace(pageCountrySpecific,'Form-countryspecific-monthly');
}
return ret;
}
}

document.getElementById("monthly-link").href = monthlyURL;
// This piece of script is add to preserve the layout of the page when the user is sent to monthly donation page
var paramsIn = parseParams(window.location.href);
var baseURL = 'https://donate.wikimedia.org/wiki/Special:FundraiserLandingPage?';

var paramsOut = paramsIn;
paramsOut.form-countryspecific = 'Form-countryspecific-monthly';

document.getElementById('monthly-link').href = baseURL + $.param(paramsOut);
</script>
</script>
</html>
</html>

Revision as of 23:02, 25 January 2012