MediaWiki:Gadget-GECharts-sandbox.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "/** * Grand Exchange Charts * Displays price data of item(s) in a chart * * Highstock docs <https://api.highcharts.com/highstock/> * Highstock change log <https://www.highcharts.com/blog/changelog/#highstock> * * @author Joeytje50 * @author Cqm * @author JaydenKieran * @author Gaz Lloyd * * @todo move Highcharts to a core ResourceLoader module * * @todo use a consistent variable for the chart id * currently it's one of c, i or id * @todo remove scr...")
 
No edit summary
Tag: Reverted
Line 82:
);
}
mw.loader.using(['mediawiki.mw.util', 'mediawiki.api', 'rs.highcharts', 'rs.highcharts-annotations', 'oojs-ui-core', 'oojs-ui.styles.icons-media'], self.init);
},
 
Line 482:
* General helper methods
*/
mw.util = {
/**
* <doc>
Line 550:
// don't modify the time (y-coord)
arr[i][0],
Math.round((mw.util.sum(list) / list.length) * round) / round
]);
}
Line 560:
/**
* Finds the sum of numbers in an array
* Only called by `mw.util.avg`
*
* @param arr {array} Array of number to find the sum of
Line 782:
rvprop: 'content',
format: 'json',
titles: 'Module:Exchange/' + mw.util.ucFirst(item)
}
).then(function(data, textStatus) {
var OOUIextraItem = $('#extraItem' + gecchartid).data('ooui-elem'),
mw.pages = data.query.mw.pages;
if (textStatus !== 'success') {
alert('An error occured while loading ' + item);
Line 793:
var matches = []
var pageMissing = false;
if (mw.pages[-1]) {
pageMissing = true;
} else {
var exchangeData = mw.pages[Object.keys(mw.pages)[0]]
.revisions[0]['*'];
matches = exchangeData.match(/itemId\D*(\d*)/);
Line 831:
}).then(function(data, textStatus) {
if (data === false) return;
$.getJSON(mw.mw.util.getUrl('Module:Exchange/'+mw.util.ucFirst(item)+'/annotations.json', {action:'raw', 'ctype':'application/json'})).then(
function(annodata){return annodata},
function(){return []} //handles the page not existing
Line 1,332:
// @todo can this be replaced with $.extend?
// @todo what is this supposed to do?
mw.util.cloneObj(_GEC['chart' + i].options, options);
 
options.chart.renderTo = 'GEpopupchart';
Line 1,399:
labelUrl = ad.link;
} else {
labelUrl = mw.mw.util.getUrl(ad.link);
}
label = '<a href="'+labelUrl+'" target="_blank">'+ad.title+'</a>';
Line 1,518:
dataList.push({
name: inputAvg + '-day average',
data: mw.util.avg(data, inputAvg, isIndexChart ? 2 : 0),
lineWidth: 2,
dashStyle: 'shortdash',
Line 1,616:
var dataType = isPopup ? 'all' : 'sample';
var url = "https://api.weirdgloop.org/exchange/history/" + gameVersion + "/" + dataType + "?compress=true&id=" + dataItemId;
var annoUrl = mw.mw.util.getUrl('Module:Exchange/'+itemName+'/annotations.json', {action:'raw', 'ctype':'application/json'});
var pricesPromise;
if (chartLoaded && itemName.toLowerCase() === 'blank') {

Navigation menu