// Generated by CoffeeScript 2.1.1
(function() {
/*
STOCK SYMBOL FORMATTER
Description: Converts stock symbols links to link to [[Google Finance]].
A full list of supported stock exchanges is available here:
http://www.google.com/googlefinance/disclaimer/
*/
var stockSymbols;
stockSymbols = function() {
var exchanges;
if ((window.mw.util.getParamValue('disable') === 'stocks' || window.mw.config.get('wgCanonicalNamespace') !== '' || window.mw.config.get('wgAction') !== 'view') && window.mw.config.get('wgPageName') !== 'Wikipedia:Sandbox' && window.mw.config.get('wgPageName') !== 'User:Gary_King/Sandbox') {
return false;
}
// Stock exchanges
exchanges = {
// Australian Securities Exchange
'ASX': '//www.asx.com.au/asx/research/companyInfo.do?by=asxCode&asxCode=',
// Stock Exchange of Thailand
'BAK': '//www.set.or.th/set/companyprofile.do?symbol=',
// Italy Stock Exchange
'BIT': '//www.borsaitaliana.it/borsa/azioni/scheda/',
// Bombay Stock Exchange
'BOM': '//www.bseindia.com/bseplus/StockReach/AdvanceStockReach.aspx?scripcode=',
// Brazilian Stock Exchange
'BVMF': '//www.bmfbovespa.com.br/cias-listadas/empresas-listadas/',
// Euronext
'EBR': '//euronext.com/products/equities/',
// Frankfurt Stock Exchange
'ETR': '//www.boerse-frankfurt.de/EN/index.aspx?pageID=23&Query=',
// Frankfurt Stock Exchange
'FRA': '//www.boerse-frankfurt.de/en/equities/search/result?name_isin_wkn=',
// Helsinki Stock Exchange
'HEL': '//www.nasdaqomxnordic.com/shares/shareinformation?Instrument=',
// Hong Kong Stock Exchange
'HKG': '//www.hkex.com.hk/eng/invest/company/quote_page_e.asp?WidCoID=',
// JASDAQ Securities Exchange
'JSD': '//www.ose.or.jp/e/listed_company_info/description/company_outline?security_code=',
// Johannesburg Stock Exchange
'JSE': 'https://www.jse.co.za/Search?k=',
// London Stock Exchange
'LON': '//www.londonstockexchange.com/exchange/searchengine/search.html?q=',
// Madrid Stock Exchange
'MCE': '//www.bolsamadrid.es/ing/aspx/Empresas/FichaValor.aspx?ISIN=',
// Mutual Funds
'MUTF': '//finance.yahoo.com/q?exchange=MUTF&s=',
// Mexican Stock Exchange
'MXK': '//www.bmv.com.mx/wb3/wb/BMV/BMV_busqueda_de_valores/_rid/222/_mto/3/_url/BMVAPP/componenteSelectorInput.jsf?cadenaCotizacion=',
// NASDAQ
'NASDAQ': '//www.nasdaq.com/symbol/',
// National Stock Exchange of India
'NSE': '//www.nseindia.com/marketinfo/companyinfo/companysearch.jsp?cons=',
// New York Stock Exchange
'NYSE': '//www.nyse.com/quote/XNYS:',
// NYSE MKT
'NYSEMKT': 'https://www.nyse.com/quote/XASE:',
// New Zealand Stock Exchange
'NZE': '//nzx.com/markets/NZSX/',
// OTC Bulletin Board
'OTC1': '//www.otcbb.com/asp/Info_Center.asp?symbol=',
// Pink Sheets
'PINK': '//www.otcmarkets.com/stock/',
// Philippine Stock Exchange
'PSE': '//www.pse.com.ph/html/MarketInformation/stockinfo.jsp?securitySymbol=',
// Brazil Stock Exchange
'SAO': '//www.bovespa.com.br/home/ExecutaAcaoCotRapXSL.asp?gstrCA=',
// Korea Exchange
'SEO': '//eng.krx.co.kr/mki/stc/stc_d_001.jsp?isu_cd=',
// Shanghai Stock Exchange
'SHA': '//www.sse.com.cn/sseportal/webapp/datapresent/SSEQueryListCmpAct?',
// Taiwan Stock Exchange
'TPE': '//www.twse.com.tw/pdf/en/',
// Toronto Stock Exchange
'TSE': '//web.tmxmoney.com/quote.php?qm_symbol=',
// Tokyo Stock Exchange
'TYO': '//www2.tse.or.jp/tseHpFront/StockSearch.do?callJorEFlg=1&method=&topSearchStr=',
// SIX Swiss Exchange
'VTX': '//www.six-swiss-exchange.com/search/quotes_en.html?security=',
// Warsaw Stock Exchange
'WSE': '//www.gpw.pl/karta_spolki_en/'
};
// Get all elements with "external" class
return $('.external').each(function(index, element) {
var exchange, lastCharacter, link, newNode, symbol, url;
link = $(element);
symbol = '';
if (!link.contents().length || !link.contents().eq(0).text()) {
return true;
}
for (exchange in exchanges) {
if (link.attr('href').indexOf(exchanges[exchange]) === -1) {
continue;
}
symbol = link.contents().eq(0).text();
// For OTC exchange only, where last character is an integer
// lastCharacter = exchange.substr(exchange.length - 1, 1);
// symbol = parseInt(lastCharacter) ? exchange.substring(0, exchange.length - 1) + ':' + symbol : exchange + ':' + symbol;
break;
}
if (symbol) {
url = 'http://finance.yahoo.com/q?s=' + symbol;
link.attr('href', url);
newNode = $('<span class="plainlinks"></span>').append(link.clone());
return link.replaceWith(newNode);
}
});
};
$(function() {
return stockSymbols();
});
}).call(this);