Skip to content

Commit

Permalink
v0.2.1 updated. board navigation functions
Browse files Browse the repository at this point in the history
see readme for more details.
  • Loading branch information
mrroach9 committed Jun 17, 2012
1 parent 821e28b commit fc09160
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 11 deletions.
36 changes: 36 additions & 0 deletions bbs_UI.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
$('.post-entry').live('click',function() {
view_post($(this).attr('post-id'), UI_update, 'click');
});


$('#last-page-button').click(function(){
view_board(bbs_current_path.board.name, -1, -1, UI_update, 'click');
});

$('#first-page-button').click(function(){
view_board(bbs_current_path.board.name, 1, -1, UI_update, 'click');
});

$('#next-page-button').click(function(){
view_board_next_page(UI_update);
Expand All @@ -42,6 +51,23 @@
$('#prev-page-button').click(function(){
view_board_prev_page(UI_update);
});

$('#jump-to-post-button').click(function(){
var post_id = $('#jump-to-post-input').val();
if (post_id != null && post_id != '') {
view_board(bbs_current_path.board.name, post_id, -1, UI_update, 'next');
}
});

$('#jump-to-post-input').keypress(function(event) {
if ( event.which == 13 ) {
var post_id = $(this).val();
if (post_id != null && post_id != '') {
view_board(bbs_current_path.board.name, post_id, -1, UI_update, 'next');
}
}
});


$('#next-post-button').click(function(){
view_next_post(UI_update);
Expand Down Expand Up @@ -228,6 +254,16 @@ function UI_maindiv_update(path, content) {
var entryStr = UI_generate_post_entry(content[i]);
$('#board-table-body').append(entryStr);
}

//Easter Eggs
if (path.board.name == 'e_note') {
$('#jump-to-post-input').attr('value', '23');
} else if (path.board.name == 'test') {
$('#jump-to-post-input').attr('value', '1481');
} else {
$('#jump-to-post-input').attr('value', '');
}

$('#board-table').show();
} else if (path.path_level == 3) {
$('#post-view-area').empty();
Expand Down
14 changes: 7 additions & 7 deletions bbs_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ function view_board(board_name, start, end, callback_func, source){
cache: false
};

if (start <= 0 || end <= 0 || end < start ||
end - start > bbs_max_post_count) {
if (start <= 0 || end - start > bbs_max_post_count) {
request_settings.data.count = bbs_post_count;
} else if (end < 0) {
request_settings.data.start = start;
request_settings.data.count = bbs_post_count;
} else {
request_settings.data.start = start;
Expand Down Expand Up @@ -148,18 +150,16 @@ function view_board_next_page(callback_func){
}
var name = bbs_current_path.board.name;
var newStart = bbs_current_path.board.end + 1;
var newEnd = newStart + bbs_post_count - 1;
view_board(name, newStart, newEnd, callback_func, 'next');
view_board(name, newStart, -1, callback_func, 'next');
}

function view_board_prev_page(callback_func){
if (bbs_current_path.path_level != 2) {
return;
}
var name = bbs_current_path.board.name;
var newEnd = bbs_current_path.board.start - 1;
var newStart = newEnd - bbs_post_count + 1;
view_board(name, newStart, newEnd, callback_func, 'prev');
var newStart = bbs_current_path.board.start - bbs_post_count;
view_board(name, newStart, -1, callback_func, 'prev');
}

/** Source marks the way you come to this function, which
Expand Down
8 changes: 6 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,14 @@ <h1>您尚未登录</h1>
</tbody>
</table>
<div class='bottom-button-bar' id='board-buttons'>
<button class='btn btn-info unimplemented' id='first-page-button'>第一页</button>
<button class='btn btn-info' id='first-page-button'>第一页</button>
<button class='btn btn-success' id='prev-page-button'>上一页</button>
<button class='btn btn-success' id='next-page-button'>下一页</button>
<button class='btn btn-info unimplemented' id='last-page-button'>最后一页</button>
<button class='btn btn-info' id='last-page-button'>最后一页</button>
<span class='jump-to-post'>
跳转至<input class='short-text' id='jump-to-post-input' />贴
<button class='btn btn-success' id='jump-to-post-button'>跳转</button>
</span>
</div>
</div>

Expand Down
20 changes: 18 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ WE WILL NEVER BE RESPONSIBLE FOR IE USERS!!!

##Development Plan

* Displaying posts in monospaced font.
* Displaying posts in monospaced font. (done in v0.2.1)

* "First Page" and "Last Page" buttons in viewing boards. Same topic navigation buttons in viewing posts.
* "First Page" and "Last Page" buttons in viewing boards. (done in v0.2.1)

* Same topic navigation buttons in viewing posts.

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

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

##Change Logs

####Version 0.2.1
Release date: 06/16/2012
Cumulative update. Various modifications and new functional on UI.

* Monospaced font is now supported in reading posts.

* Notification displaying time decreases from 3s to 2s. User can click anywhere on the notif. bar besides the close button to close it immediately.

* Decreased the width of entire container from >1100px downto 960px, making it looks better under low-resolutional screens.

* A bug from pybbs is fixed, which used to cause exceptions when reading posts containing 0x80 chars.

* First page, last page, and jump to certain position in board viewing is now supported.

####Version 0.2.0
Release date: 06/15/2012

Expand Down
12 changes: 12 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ tr.post-entry {
text-align: center;
}

#board-buttons.bottom-button-bar {
margin-left : 140px;
}

.post-view-area {
margin-left: 10px;
margin-bottom: 10px;
Expand Down Expand Up @@ -108,6 +112,14 @@ p#notification-content {
width : 30px;
}

.bottom-button-bar .short-text {
width : 40px;
}

.jump-to-post {
margin-left : 20px;
}

.radiobox {
display: inline;
margin-left : 10px;
Expand Down

0 comments on commit fc09160

Please sign in to comment.