-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinit.js
97 lines (88 loc) · 3.29 KB
/
init.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
function loadConfigSynchronously() {
var config = '';
$.ajax({
dataType: 'json',
url: 'config.json',
async: false,
success: function(data) {
config = data;
}
});
return config;
}
function getStockSymbol() {
var url = purl(location.search);
return url.param('stock_symbol') || '1101';
}
function initContentTitle() {
var headerElement = document.createElement('div');
headerElement.className = 'title';
headerElement.innerHTML = '財務比率分析 - ' + getStockSymbol();
var rootElement = document.getElementById('content_div');
rootElement.appendChild(headerElement);
}
function initContentBody(config) {
var rootElement = document.getElementById('content_div');
rootElement.appendChild(makeSections(config));
}
function initContentCharts() {
var stockSymbol = getStockSymbol();
makeCapitalStructureChart(stockSymbol, 'yearly');
makeCapitalStructureChart(stockSymbol, 'quarterly');
makeCapitalIncreaseHistoryChart(stockSymbol);
makeCashFlowChart(stockSymbol, 'yearly');
makeCashFlowChart(stockSymbol, 'quarterly');
makeCccChart(stockSymbol, 'yearly');
makeCccChart(stockSymbol, 'quarterly');
makeDividendPolicy(stockSymbol);
makeDupontChart(stockSymbol, 'yearly');
makeDupontChart(stockSymbol, 'quarterly');
makeLiquidityChart(stockSymbol, 'yearly');
makeLiquidityChart(stockSymbol, 'quarterly');
makeLongTermInvestmentsToAssetsRatioChart(stockSymbol, 'yearly');
makeLongTermInvestmentsToAssetsRatioChart(stockSymbol, 'quarterly');
makeNetIncomeToOperatingActivitiesChart(stockSymbol, 'yearly');
makeNetIncomeToOperatingActivitiesChart(stockSymbol, 'quarterly');
makeOperatingRevenueChart(stockSymbol);
makeProfitabilityChart(stockSymbol, 'yearly');
makeProfitabilityChart(stockSymbol, 'quarterly');
makeRevenueIndexChart(stockSymbol, 'yearly');
makeRevenueIndexChart(stockSymbol, 'quarterly');
makeKnChart(stockSymbol, 'yearly');
makeKnChart(stockSymbol, 'quarterly');
}
function initContent(config) {
initContentTitle();
initContentBody(config);
initContentCharts();
}
function initSitebar(config) {
var rootElement = document.getElementById('sidebar_div');
rootElement.appendChild(makeSidebar(config));
}
function initHeader() {
var headerElement = document.createElement('div');
headerElement.className = 'title';
headerElement.innerHTML = '股市貓';
var rootElement = document.getElementById('header_div');
rootElement.appendChild(headerElement);
}
function initFooter() {
var rootElement = document.getElementById('footer_div');
var texts = [
'以上資料僅供參考,本站不負任何法律責任,投資人若依此以為買賣依據,須自負盈虧之責。資料來源:<a target="_blank" href="http://mops.twse.com.tw/">公開資訊觀測站</a>。',
'Facebook: Meng-Gen Tsai ([email protected])',
];
for (var i = 0; i < texts.length; i++) {
var paragraphElement = document.createElement('p');
paragraphElement.innerHTML = texts[i];
rootElement.appendChild(paragraphElement);
}
}
function init() {
var config = loadConfigSynchronously();
initHeader();
initContent(config);
initSitebar(config);
initFooter();
}