Hi all,
I added an input widget for pagination. I'd like to share it here, maybe someone needs. If there are many pages, specifying the page number will be useful.
The picture and patch code are in the attachment
Regards,
Xuan |
--- elogd.c.org 2019-05-14 10:12:01.891558950 +0800
+++ elogd.c 2019-05-14 10:44:38.165898395 +0800
@@ -19407,6 +19407,26 @@ void show_page_navigation(LOGBOOK * lbs,
rsprintf("<a href=\"%s\">%s</a>\n", ref, loc("All"));
}
+ sprintf(ref, "");
+ build_ref(ref, sizeof(ref), "", "", "", "");
+
+ rsprintf("<input id=\"setPage\" title=\"Goto\" type=number size=\"6\" onChange=\'getPage(\"%d\");\'>", num_pages);
+ rsprintf("<script language=\"JavaScript\" type=\"text/javascript\">\n");
+ rsprintf("<!--\n");
+ rsprintf("function getPage(max)\n");
+ rsprintf(" {\n");
+ rsprintf(" var value = document.getElementById('setPage').value;\n");
+ rsprintf(" value = parseInt(value);\n");
+ rsprintf(" if(value > max)\n");
+ rsprintf(" value = max;\n");
+ rsprintf(" if(value < 1)\n");
+ rsprintf(" value = 1;\n");
+ rsprintf(" var url = 'page' + value + \"%s\";\n", ref);
+ rsprintf(" window.location.href = url;\n");
+ rsprintf(" }\n");
+ rsprintf("//-->\n");
+ rsprintf("</script>\n");
+
rsprintf("</span></td></tr>\n");
}
|