+// 表示しているコミック識別用
+request__ix = '';
+request__pg = 1;
+request__re = '';
+
+
// ページ保持用変数
pg_cur = 1;
pg_max = 1;
auto_icon_off = "■";
+// 前のページに戻る
+function goback() {
+
+ if (request__re=='') {
+ history.back();
+ } else {
+ location.href = request__re;
+ }
+
+
+}
+
// ページロード時の処理
$(function() {
+ // 初期表示のチラツキを無くすために、ロード直後にフェードアウト
+ $("img#viewbox_canvas").fadeOut(0);
+
+ request__ix = $("#request_ix").html();
+ request__pg = Number($("#request_pg").html());
+ request__re = $("#request_re").html();
+
+ pg_cur = request__pg;
page_read();
});
// J
case 74:
- $("span#page").trigger("click");
+ $("#cmd_page").trigger("click");
break;
// A
});
-// ã\83\9aã\83¼ã\82¸ã\83£ã\82¤ã\83³ã\82¿ã\83¼ã\83\95ã\82§ã\82¤ã\82¹
+// ã\82¤ã\83\99ã\83³ã\83\88ã\83\8fã\83³ã\83\89ã\83©ã\81®å®\9a義
$(function() {
- $("a#next").click(function(){
+ $("#cmd_next").click(function(){
page_change(+1);
});
- $("a#prior").click(function(){
+ $("#cmd_prior").click(function(){
page_change(-1);
});
- $("a#next2").click(function(){
+ $("#cmd_next2").click(function(){
page_change(+2);
});
- $("a#prior2").click(function(){
+ $("#cmd_prior2").click(function(){
page_change(-2);
});
- $("span#page").click(function(){
+ $("#viewbox_canvas").click(function(){
+ page_change(+1);
+ });
+
+ $("#cmd_page").click(function(){
pg_new = prompt('移動するページ番号を入力してください',pg_cur);
if (pg_new != null) {
if (isNaN(pg_new)) {
alert('有効な数値を入力してください');
} else {
- pg_cur = 0;
- page_change(Number(pg_new));
+ page_jump(Number(pg_new));
}
}
});
- $("a#auto").click(function(){
+ $("#cmd_auto").click(function(){
if (auto_timerid == null) {
interval = prompt('自動ページ送り:表示間隔を秒数で入力してください','20');
if (interval != null) {
}
});
- $("a#bookmark").click(function(){
- comment = prompt('ブックマーク(Page='+pg_cur+'):コメントを入力して下さい','');
- if (comment != null) {
+ $("#cmd_bookmark").toggle(
+ function(){
+ $("#bookmark").css("display","block");
+ $("#bookmark").animate({
+ top: "0"
+ },300);
+ },
+ function(){
+ $("#bookmark").animate({
+ top: "-20.5em"
+ },300);
}
- });
+ );
});
}
+// ページ指定ジャンプ
+function page_jump(pg) {
+ pg_cur = 0;
+ page_change(pg);
+}
+
+
// ページを読み込んで表示する
function page_read() {
$("#viewbox_canvas").fadeOut("fast",function() {
- $(this).attr("src","./page.php?ix="+$("#request_ix").html()+"&pg="+pg_cur);
+ $(this).attr("src","./page.php?ix="+request__ix+"&pg="+pg_cur);
$(this).load(function () {
// 最初のページ読み込み後にコミックの情報を取得する
if (info_read==0) {
- $.getJSON("./info.json.php?q=page&ix="+$("#request_ix").html(), function(json){
+ $.getJSON("./comic.json.php?q=page&ix="+$("#request_ix").html(), function(json){
$("#title").text(json.path);
pg_max = json.page.max;
page_change_after();
});
+
+ $.getJSON("./bookmark.json.php?q=get&ix="+$("#request_ix").html(), function(json){
+ bookmark_parse(json);
+ });
+
info_read = 1;
} else {
function page_change_after() {
- $("#page").text(pg_cur + " / " + pg_max);
+ $("#cmd_page").text(pg_cur + " / " + pg_max);
$(window).trigger("resize");
}
}
+
+
+/* 新しいブックマークを追加 */
+function bookmark_create() {
+
+ comment = prompt('ブックマーク(P.'+pg_cur+'):コメントを入力して下さい','');
+ if (comment != null) {
+ $.post(
+ './bookmark.json.php',
+ {
+ 'q' : 'mark',
+ 'ix' : request__ix,
+ 'pg' : pg_cur,
+ 'com' : comment
+ },
+ function(data) {
+ json = $.parseJSON(data);
+ bookmark_parse(json);
+ }
+ );
+ }
+
+}
+
+/* ブックマークを削除 */
+function bookmark_remove(pg) {
+
+ $.post(
+ './bookmark.json.php',
+ {
+ 'q' : 'remove',
+ 'ix' : request__ix,
+ 'pg' : pg_cur
+ },
+ function(data) {
+ json = $.parseJSON(data);
+ bookmark_parse(json);
+ }
+ );
+
+}
+
+/* ブックマーク全消去 */
+function bookmark_clear() {
+
+ if (confirm('登録されているブックマークをすべて消去しますか?')) {
+ $.post(
+ './bookmark.json.php',
+ {
+ 'q' : 'clear',
+ 'ix' : request__ix
+ },
+ function(data) {
+ json = $.parseJSON(data);
+ bookmark_parse(json);
+ }
+ );
+ }
+
+}
+
+// 受け取ったjsonデータをメニューに表示
+function bookmark_parse(json) {
+
+ $("#bookmark_list").empty();
+
+ for (i=0;i<json.count;i++) {
+ li =
+ "<li><a href=\"javascript://\" onclick=\"javascript:bookmark_click("+json.mark[i].pg+");\">"+
+ json.mark[i].comment+"(P."+json.mark[i].pg+")</a> "+
+ "<a href=\"javascript://\" onclick=\"javascript:bookmark_remove("+json.mark[i].pg+");\">×削除</a>"+
+ "</li>"
+ ;
+ $("#bookmark_list").append(li);
+ }
+
+}
+
+// ブックマークの全消去
+function bookmark_click(pg) {
+ page_jump(pg);
+ $('#cmd_bookmark').trigger('click');
+}