Commit 69362134 authored by Thierry BUGEAT's avatar Thierry BUGEAT

#33 Add next & previous news titles at bottom of page.

parent 18ead7fe
......@@ -41,6 +41,7 @@
<link href="style/switches.css" type="text/css" rel="stylesheet">
<link href="style/buttons.css" type="text/css" rel="stylesheet">
<link href="style/input_areas.css" type="text/css" rel="stylesheet">
<link href="style/main-entry.css" type="text/css" rel="stylesheet">
</head>
<body>
......@@ -190,6 +191,13 @@
<div id="browser"></div>
</div>
<section role="mySubEntry">
<header class="mySystemHeader">
<span><div id="nextEntryTitle"></div></span>
<span><div id="previousEntryTitle"></div></span>
</header>
</section>
<section role="myFooter" class="">
<header>
<button id="closeMainEntry"><span data-icon="close"></span></button>
......
......@@ -1530,6 +1530,11 @@
liveValues['entries']['id']['min'] = _nb;
}
/**
* @param {int} entryId
* @param {string} url
* @return {CustomEvent} mainEntryOpen.done
* */
function mainEntryOpenInBrowser(entryId, url) {
my.log('mainEntryOpenInBrowser()', arguments);
document.body.style.cssText = "overflow: hidden;"; // Disable scroll in entries list.
......@@ -1965,6 +1970,7 @@
// Main entry open done...
// Update next entry [<] & previous entry [>] buttons.
// Update next & previous entries titles
document.body.addEventListener('mainEntryOpen.done', function(event){
......@@ -2027,48 +2033,52 @@
// [<]
if (my.isSmallEntry(sortedEntries[_nextEntryId])) {
dom['entry']['next'].setAttribute("i", _nextEntryId);
dom['entry']['next'].setAttribute("entry_link", sortedEntries[_nextEntryId].link);
dom['entry']['next']['button'].setAttribute("i", _nextEntryId);
dom['entry']['next']['button'].setAttribute("entry_link", sortedEntries[_nextEntryId].link);
} else {
dom['entry']['next'].setAttribute("i", _nextEntryId);
dom['entry']['next'].setAttribute("entry_link", "");
dom['entry']['next']['button'].setAttribute("i", _nextEntryId);
dom['entry']['next']['button'].setAttribute("entry_link", "");
}
// [>]
if (my.isSmallEntry(sortedEntries[_previousEntryId])) {
dom['entry']['previous'].setAttribute("i", _previousEntryId);
dom['entry']['previous'].setAttribute("entry_link", sortedEntries[_previousEntryId].link);
dom['entry']['previous']['button'].setAttribute("i", _previousEntryId);
dom['entry']['previous']['button'].setAttribute("entry_link", sortedEntries[_previousEntryId].link);
} else {
dom['entry']['previous'].setAttribute("i", _previousEntryId);
dom['entry']['previous'].setAttribute("entry_link", "");
dom['entry']['previous']['button'].setAttribute("i", _previousEntryId);
dom['entry']['previous']['button'].setAttribute("entry_link", "");
}
// Disable / enable button [<]
if ((_nextEntryId < liveValues['entries']['id']['min']) || (_nextEntryId == _entryId)) {
ui._onclick(dom['entry']['next'], 'disable');
ui._onclick(dom['entry']['next']['button'], 'disable');
ui.echo("nextEntryTitle", "", "");
} else {
ui._onclick(dom['entry']['next'], 'enable');
ui._onclick(dom['entry']['next']['button'], 'enable');
ui.echo("nextEntryTitle", sortedEntries[_nextEntryId].title, "");
}
// Disable / enable button [>]
if ((_previousEntryId > liveValues['entries']['id']['max']) || (_previousEntryId == _entryId)) {
ui._onclick(dom.entry['previous'], 'disable');
ui._onclick(dom.entry['previous']['button'], 'disable');
ui.echo("previousEntryTitle", "", "");
} else {
ui._onclick(dom.entry['previous'], 'enable');
ui._onclick(dom.entry['previous']['button'], 'enable');
ui.echo("previousEntryTitle", sortedEntries[_previousEntryId].title, "");
}
});
// ---
dom['entry']['next'].onclick = function() {
dom['entry']['next']['button'].onclick = function() {
mainEntryOpenInBrowser(this.getAttribute("i"), this.getAttribute("entry_link"));
}
dom['entry']['previous'].onclick = function() {
dom['entry']['previous']['button'].onclick = function() {
mainEntryOpenInBrowser(this.getAttribute("i"), this.getAttribute("entry_link"));
}
......
......@@ -34,8 +34,14 @@ var dom = {
"feeds": document.getElementById("topupFeedsList")
},
"entry": {
"next": document.getElementById("nextEntry"),
"previous": document.getElementById("previousEntry")
"next": {
"button": document.getElementById("nextEntry"),
"title": document.getElementById("nextEntryTitle")
},
"previous": {
"button": document.getElementById("previousEntry"),
"title": document.getElementById("previousEntryTitle")
}
}
};
var search = document.getElementById("search");
......
......@@ -75,7 +75,7 @@ form{
box-sizing: border-box;
padding:0;
width:100%;
height: calc(100% - 9.5rem);
height: calc(100% - 13.5rem);
background-color:#FFFFFF;
overflow-x:hidden;
overflow-y:auto;
......
......@@ -7,7 +7,7 @@
/* ====================== */
/* --- Default Header --- */
/* ====================== */
section[role="mySubHeader"] {
width: 100%;
height: 4rem;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment