Difference between revisions of "MediaWiki:Common.js"
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
− | + | var basePage = getParameterByName('Scenario_Task_Translation[Base+Page]'); | |
if ($('textarea[name="Scenario Task Translation[Scenario Task Description]"]')) { | if ($('textarea[name="Scenario Task Translation[Scenario Task Description]"]')) { | ||
− | var query = 'http://mywiki/mw/api.php?action=ask&query=[[ | + | var query = 'http://mywiki/mw/api.php?action=ask&query=[[' + basePage + ']]|?Scenario Task Description&format=json'; |
$.getJSON(query, function(data) { | $.getJSON(query, function(data) { | ||
console.log('data', data); | console.log('data', data); |
Revision as of 00:38, 17 November 2015
/* Any JavaScript here will be loaded for all users on every page load. */ var basePage = getParameterByName('Scenario_Task_Translation[Base+Page]'); if ($('textarea[name="Scenario Task Translation[Scenario Task Description]"]')) { var query = 'http://mywiki/mw/api.php?action=ask&query=[[' + basePage + ']]|?Scenario Task Description&format=json'; $.getJSON(query, function(data) { console.log('data', data); }); } function getParameterByName(name) { if (window.location.search.indexOf(name) > -1) { value = window.location.search.split('&')[1].split('=')[1]; return value; } }