Skip to content

Commit fc09160

Browse files
committed
v0.2.1 updated. board navigation functions
see readme for more details.
1 parent 821e28b commit fc09160

File tree

5 files changed

+79
-11
lines changed

5 files changed

+79
-11
lines changed

bbs_UI.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@
3434
$('.post-entry').live('click',function() {
3535
view_post($(this).attr('post-id'), UI_update, 'click');
3636
});
37+
38+
39+
$('#last-page-button').click(function(){
40+
view_board(bbs_current_path.board.name, -1, -1, UI_update, 'click');
41+
});
42+
43+
$('#first-page-button').click(function(){
44+
view_board(bbs_current_path.board.name, 1, -1, UI_update, 'click');
45+
});
3746

3847
$('#next-page-button').click(function(){
3948
view_board_next_page(UI_update);
@@ -42,6 +51,23 @@
4251
$('#prev-page-button').click(function(){
4352
view_board_prev_page(UI_update);
4453
});
54+
55+
$('#jump-to-post-button').click(function(){
56+
var post_id = $('#jump-to-post-input').val();
57+
if (post_id != null && post_id != '') {
58+
view_board(bbs_current_path.board.name, post_id, -1, UI_update, 'next');
59+
}
60+
});
61+
62+
$('#jump-to-post-input').keypress(function(event) {
63+
if ( event.which == 13 ) {
64+
var post_id = $(this).val();
65+
if (post_id != null && post_id != '') {
66+
view_board(bbs_current_path.board.name, post_id, -1, UI_update, 'next');
67+
}
68+
}
69+
});
70+
4571

4672
$('#next-post-button').click(function(){
4773
view_next_post(UI_update);
@@ -228,6 +254,16 @@ function UI_maindiv_update(path, content) {
228254
var entryStr = UI_generate_post_entry(content[i]);
229255
$('#board-table-body').append(entryStr);
230256
}
257+
258+
//Easter Eggs
259+
if (path.board.name == 'e_note') {
260+
$('#jump-to-post-input').attr('value', '23');
261+
} else if (path.board.name == 'test') {
262+
$('#jump-to-post-input').attr('value', '1481');
263+
} else {
264+
$('#jump-to-post-input').attr('value', '');
265+
}
266+
231267
$('#board-table').show();
232268
} else if (path.path_level == 3) {
233269
$('#post-view-area').empty();

bbs_view.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ function view_board(board_name, start, end, callback_func, source){
7979
cache: false
8080
};
8181

82-
if (start <= 0 || end <= 0 || end < start ||
83-
end - start > bbs_max_post_count) {
82+
if (start <= 0 || end - start > bbs_max_post_count) {
83+
request_settings.data.count = bbs_post_count;
84+
} else if (end < 0) {
85+
request_settings.data.start = start;
8486
request_settings.data.count = bbs_post_count;
8587
} else {
8688
request_settings.data.start = start;
@@ -148,18 +150,16 @@ function view_board_next_page(callback_func){
148150
}
149151
var name = bbs_current_path.board.name;
150152
var newStart = bbs_current_path.board.end + 1;
151-
var newEnd = newStart + bbs_post_count - 1;
152-
view_board(name, newStart, newEnd, callback_func, 'next');
153+
view_board(name, newStart, -1, callback_func, 'next');
153154
}
154155

155156
function view_board_prev_page(callback_func){
156157
if (bbs_current_path.path_level != 2) {
157158
return;
158159
}
159160
var name = bbs_current_path.board.name;
160-
var newEnd = bbs_current_path.board.start - 1;
161-
var newStart = newEnd - bbs_post_count + 1;
162-
view_board(name, newStart, newEnd, callback_func, 'prev');
161+
var newStart = bbs_current_path.board.start - bbs_post_count;
162+
view_board(name, newStart, -1, callback_func, 'prev');
163163
}
164164

165165
/** Source marks the way you come to this function, which

index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,14 @@ <h1>您尚未登录</h1>
170170
</tbody>
171171
</table>
172172
<div class='bottom-button-bar' id='board-buttons'>
173-
<button class='btn btn-info unimplemented' id='first-page-button'>第一页</button>
173+
<button class='btn btn-info' id='first-page-button'>第一页</button>
174174
<button class='btn btn-success' id='prev-page-button'>上一页</button>
175175
<button class='btn btn-success' id='next-page-button'>下一页</button>
176-
<button class='btn btn-info unimplemented' id='last-page-button'>最后一页</button>
176+
<button class='btn btn-info' id='last-page-button'>最后一页</button>
177+
<span class='jump-to-post'>
178+
跳转至<input class='short-text' id='jump-to-post-input' />
179+
<button class='btn btn-success' id='jump-to-post-button'>跳转</button>
180+
</span>
177181
</div>
178182
</div>
179183

readme.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ WE WILL NEVER BE RESPONSIBLE FOR IE USERS!!!
3232

3333
##Development Plan
3434

35-
* Displaying posts in monospaced font.
35+
* Displaying posts in monospaced font. (done in v0.2.1)
3636

37-
* "First Page" and "Last Page" buttons in viewing boards. Same topic navigation buttons in viewing posts.
37+
* "First Page" and "Last Page" buttons in viewing boards. (done in v0.2.1)
38+
39+
* Same topic navigation buttons in viewing posts.
3840

3941
* Notification system for info, warning and errors.(done in v0.1.2)
4042

@@ -60,6 +62,20 @@ WE WILL NEVER BE RESPONSIBLE FOR IE USERS!!!
6062

6163
##Change Logs
6264

65+
####Version 0.2.1
66+
Release date: 06/16/2012
67+
Cumulative update. Various modifications and new functional on UI.
68+
69+
* Monospaced font is now supported in reading posts.
70+
71+
* Notification displaying time decreases from 3s to 2s. User can click anywhere on the notif. bar besides the close button to close it immediately.
72+
73+
* Decreased the width of entire container from >1100px downto 960px, making it looks better under low-resolutional screens.
74+
75+
* A bug from pybbs is fixed, which used to cause exceptions when reading posts containing 0x80 chars.
76+
77+
* First page, last page, and jump to certain position in board viewing is now supported.
78+
6379
####Version 0.2.0
6480
Release date: 06/15/2012
6581

style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ tr.post-entry {
4848
text-align: center;
4949
}
5050

51+
#board-buttons.bottom-button-bar {
52+
margin-left : 140px;
53+
}
54+
5155
.post-view-area {
5256
margin-left: 10px;
5357
margin-bottom: 10px;
@@ -108,6 +112,14 @@ p#notification-content {
108112
width : 30px;
109113
}
110114

115+
.bottom-button-bar .short-text {
116+
width : 40px;
117+
}
118+
119+
.jump-to-post {
120+
margin-left : 20px;
121+
}
122+
111123
.radiobox {
112124
display: inline;
113125
margin-left : 10px;

0 commit comments

Comments
 (0)