|
@@ -6,6 +6,7 @@
|
6
|
6
|
<script src="externals/flot/jquery.flot.js" type="text/javascript"></script>
|
7
|
7
|
<script src="externals/flot/jquery.flot.pie.js" type="text/javascript"></script>
|
8
|
8
|
<script src="externals/flot/jquery.flot.selection.js" type="text/javascript"></script>
|
|
9
|
+ <script src="externals/jquery.history/jquery.history.js" type="text/javascript"></script>
|
9
|
10
|
<script src="data.php" type="text/javascript"></script>
|
10
|
11
|
<script type="text/javascript">
|
11
|
12
|
var previousPoint = null;
|
|
@@ -147,12 +148,12 @@
|
147
|
148
|
var startDate = parseInt(ranges.xaxis.from.toFixed());
|
148
|
149
|
var endDate = parseInt(ranges.xaxis.to.toFixed());
|
149
|
150
|
|
150
|
|
- showSelectedMonths(startDate, endDate, 0);
|
|
151
|
+ $.history.load('start:' + startDate + ';end:' + endDate + ';type:expenses');
|
151
|
152
|
});
|
152
|
153
|
|
153
|
154
|
$('#history').bind('plotclick', function(event, pos, item) {
|
154
|
155
|
if (item) {
|
155
|
|
- showSelectedMonths(item.datapoint[0], item.datapoint[0], item.seriesIndex == 0, item.seriesIndex == 1);
|
|
156
|
+ $.history.load('start:' + item.datapoint[0] + ';end:' + item.datapoint[0] + ';type:' + (item.seriesIndex == 0 ? 'income' : 'expenses'));
|
156
|
157
|
}
|
157
|
158
|
});
|
158
|
159
|
|
|
@@ -160,6 +161,15 @@
|
160
|
161
|
$('#historytable .data').hide();
|
161
|
162
|
$('#historytable .category' + item.series.label.replace(/[^a-zA-Z]*/g, '')).show();
|
162
|
163
|
});
|
|
164
|
+
|
|
165
|
+ $.history.init(function(hash) {
|
|
166
|
+ var match = /start:([0-9]+);end:([0-9]+);type:(income|expenses)/.exec(hash);
|
|
167
|
+
|
|
168
|
+ if (match != null) {
|
|
169
|
+ showSelectedMonths(parseInt(match[1]), parseInt(match[2]), match[3] == 'income', match[3] == 'expenses');
|
|
170
|
+ plots.history.setSelection({ xaxis: { from: parseInt(match[1]), to: parseInt(match[2]) }});
|
|
171
|
+ }
|
|
172
|
+ });
|
163
|
173
|
});
|
164
|
174
|
</script>
|
165
|
175
|
<style type="text/css">
|