1
0
Fork 0

Ask for confirmation before clicking on mark all as read

This commit is contained in:
Frédéric Guillot 2019-07-17 21:52:45 -07:00
parent ac3693562b
commit a634839678
19 changed files with 39 additions and 66 deletions

View file

@ -38,7 +38,6 @@ var translations = map[string]string{
"menu.create_category": "Kategorie anlegen", "menu.create_category": "Kategorie anlegen",
"menu.mark_page_as_read": "Diese Seite als gelesen markieren", "menu.mark_page_as_read": "Diese Seite als gelesen markieren",
"menu.mark_all_as_read": "Alle als gelesen markieren", "menu.mark_all_as_read": "Alle als gelesen markieren",
"menu.mark_all_as_read_wip": "In Arbeit...",
"menu.show_all_entries": "Zeige alle Artikel", "menu.show_all_entries": "Zeige alle Artikel",
"menu.show_only_unread_entries": "Nur ungelesene Artikel anzeigen", "menu.show_only_unread_entries": "Nur ungelesene Artikel anzeigen",
"menu.refresh_feed": "Aktualisieren", "menu.refresh_feed": "Aktualisieren",
@ -333,7 +332,6 @@ var translations = map[string]string{
"menu.create_category": "Create a category", "menu.create_category": "Create a category",
"menu.mark_page_as_read": "Mark this page as read", "menu.mark_page_as_read": "Mark this page as read",
"menu.mark_all_as_read": "Mark all as read", "menu.mark_all_as_read": "Mark all as read",
"menu.mark_all_as_read_wip": "Operation in progress...",
"menu.show_all_entries": "Show all entries", "menu.show_all_entries": "Show all entries",
"menu.show_only_unread_entries": "Show only unread entries", "menu.show_only_unread_entries": "Show only unread entries",
"menu.refresh_feed": "Refresh", "menu.refresh_feed": "Refresh",
@ -608,7 +606,6 @@ var translations = map[string]string{
"menu.create_category": "Crear una categoría", "menu.create_category": "Crear una categoría",
"menu.mark_page_as_read": "Marcar esta pagína como leída", "menu.mark_page_as_read": "Marcar esta pagína como leída",
"menu.mark_all_as_read": "Marcar todos como leídos", "menu.mark_all_as_read": "Marcar todos como leídos",
"menu.mark_all_as_read_wip": "Operación en progreso...",
"menu.show_all_entries": "Mostrar todas las entradas", "menu.show_all_entries": "Mostrar todas las entradas",
"menu.show_only_unread_entries": "Mostrar solo las entradas no leídas", "menu.show_only_unread_entries": "Mostrar solo las entradas no leídas",
"menu.refresh_feed": "Refrescar", "menu.refresh_feed": "Refrescar",
@ -883,7 +880,6 @@ var translations = map[string]string{
"menu.create_category": "Créer une catégorie", "menu.create_category": "Créer une catégorie",
"menu.mark_page_as_read": "Marquer cette page comme lu", "menu.mark_page_as_read": "Marquer cette page comme lu",
"menu.mark_all_as_read": "Tout marquer comme lu", "menu.mark_all_as_read": "Tout marquer comme lu",
"menu.mark_all_as_read_wip": "Opération en cours...",
"menu.show_all_entries": "Afficher tous les articles", "menu.show_all_entries": "Afficher tous les articles",
"menu.show_only_unread_entries": "Afficher uniquement les articles non lus", "menu.show_only_unread_entries": "Afficher uniquement les articles non lus",
"menu.refresh_feed": "Actualiser", "menu.refresh_feed": "Actualiser",
@ -1178,7 +1174,6 @@ var translations = map[string]string{
"menu.create_category": "Aggiungi una categoria", "menu.create_category": "Aggiungi una categoria",
"menu.mark_page_as_read": "Segna questa pagina come letta", "menu.mark_page_as_read": "Segna questa pagina come letta",
"menu.mark_all_as_read": "Segna tutti gli articoli come letti", "menu.mark_all_as_read": "Segna tutti gli articoli come letti",
"menu.mark_all_as_read_wip": "Operazione in corso...",
"menu.show_all_entries": "Mostra tutte le voci", "menu.show_all_entries": "Mostra tutte le voci",
"menu.show_only_unread_entries": "Mostra solo voci non lette", "menu.show_only_unread_entries": "Mostra solo voci non lette",
"menu.refresh_feed": "Aggiorna", "menu.refresh_feed": "Aggiorna",
@ -1453,7 +1448,6 @@ var translations = map[string]string{
"menu.create_category": "Categorie toevoegen", "menu.create_category": "Categorie toevoegen",
"menu.mark_page_as_read": "Markeer deze pagina als gelezen", "menu.mark_page_as_read": "Markeer deze pagina als gelezen",
"menu.mark_all_as_read": "Markeer alle items als gelezen", "menu.mark_all_as_read": "Markeer alle items als gelezen",
"menu.mark_all_as_read_wip": "Bezig...",
"menu.show_all_entries": "Toon alle artikelen", "menu.show_all_entries": "Toon alle artikelen",
"menu.show_only_unread_entries": "Toon alleen ongelezen artikelen", "menu.show_only_unread_entries": "Toon alleen ongelezen artikelen",
"menu.refresh_feed": "Vernieuwen", "menu.refresh_feed": "Vernieuwen",
@ -1746,7 +1740,6 @@ var translations = map[string]string{
"menu.create_category": "Utwórz kategorię", "menu.create_category": "Utwórz kategorię",
"menu.mark_page_as_read": "Oznacz jako przeczytane", "menu.mark_page_as_read": "Oznacz jako przeczytane",
"menu.mark_all_as_read": "Oznacz wszystko jako przeczytane", "menu.mark_all_as_read": "Oznacz wszystko jako przeczytane",
"menu.mark_all_as_read_wip": "W toku...",
"menu.show_all_entries": "Pokaż wszystkie artykuły", "menu.show_all_entries": "Pokaż wszystkie artykuły",
"menu.show_only_unread_entries": "Pokaż tylko nieprzeczytane artykuły", "menu.show_only_unread_entries": "Pokaż tylko nieprzeczytane artykuły",
"menu.refresh_feed": "Odśwież", "menu.refresh_feed": "Odśwież",
@ -2047,7 +2040,6 @@ var translations = map[string]string{
"menu.create_category": "Создать категорию", "menu.create_category": "Создать категорию",
"menu.mark_page_as_read": "Отметить эту страницу прочитанной", "menu.mark_page_as_read": "Отметить эту страницу прочитанной",
"menu.mark_all_as_read": "Отметить всё как прочитанное", "menu.mark_all_as_read": "Отметить всё как прочитанное",
"menu.mark_all_as_read_wip": "В процессе…",
"menu.show_all_entries": "Показать все статьи", "menu.show_all_entries": "Показать все статьи",
"menu.show_only_unread_entries": "Показывать только непрочитанные статьи", "menu.show_only_unread_entries": "Показывать только непрочитанные статьи",
"menu.refresh_feed": "Обновить", "menu.refresh_feed": "Обновить",
@ -2330,7 +2322,6 @@ var translations = map[string]string{
"menu.create_category": "新建分类", "menu.create_category": "新建分类",
"menu.mark_page_as_read": "标记为已读", "menu.mark_page_as_read": "标记为已读",
"menu.mark_all_as_read": "全部标为已读", "menu.mark_all_as_read": "全部标为已读",
"menu.mark_all_as_read_wip": "执行中…",
"menu.show_all_entries": "显示所有条目", "menu.show_all_entries": "显示所有条目",
"menu.show_only_unread_entries": "仅显示未读文章", "menu.show_only_unread_entries": "仅显示未读文章",
"menu.refresh_feed": "更新", "menu.refresh_feed": "更新",
@ -2583,13 +2574,13 @@ var translations = map[string]string{
} }
var translationsChecksums = map[string]string{ var translationsChecksums = map[string]string{
"de_DE": "24812dcba285e56e042486c7f3d6fd9b915b37dc8473640d5099bade94e702b2", "de_DE": "113b5f099a990378c4d929cec236170ff16cddbbdf8f24c26112fde1ce0f19d3",
"en_US": "491b3765c7e7b1a3e49b265bf3358a48b6d9aeea5340777a38957ad216101b9d", "en_US": "5a5a1f1b16f4ba3ebcb32d44abd9345a0dd21085c44bf7a80da5b0632c33db44",
"es_ES": "89b84d2505fc27d3f75b2622eae78373c6ce465dc180e1e5bf2a4aca25f73f2e", "es_ES": "6f37983ba3c3558612ab2dac6a210931587986f426062383762259c616e32646",
"fr_FR": "ac80056831e39c48b47d54299ff112fd9f5e35d14fa248b6a5ae049045cf1537", "fr_FR": "bb66ad1f6460f9ddc1ceb95af5c9f0d2e57db80cbea2f4938c8b9555b3244cf6",
"it_IT": "b3521ffb2f56810568bc2317846f2dd16dad77b76dadec5990598af2a6e49403", "it_IT": "36282ed96b3e7e90c50c4dc35edeccc5e79087d4d0f8d425ffb323bff63f3963",
"nl_NL": "7d095d9c8915e7ae79d28d35793cb6fce04c867e35b9b4a956da45a7f1a0925c", "nl_NL": "e3386b1c6756ee49b779241d34e84cd005dbe1c9ed4d30a93a5afc2645a2d32f",
"pl_PL": "d99b8dcf56f5672e261b231f01cdf5e17f9c3aa422c798f994aa480a1d9a92e6", "pl_PL": "ec7104556cead2d673a1c6c8384b12496128f2a618e332a748d16c684bac516d",
"ru_RU": "4c135a56164be9223d87c50d738d8096c9e732c8ec51ee4a7c7db09ee634837a", "ru_RU": "af4dbbe97a49ae2af33470f4605ddd1027f62d98c191da339c6cc518995ff323",
"zh_CN": "c1481025b98c282b284aae12e61d5f2356f4d83797d25a596afb67c3e170c6bf", "zh_CN": "5e9b0f3dd3d3aae78196ec763faf56099018bc232a684080cf60354dc2446cc0",
} }

View file

@ -33,7 +33,6 @@
"menu.create_category": "Kategorie anlegen", "menu.create_category": "Kategorie anlegen",
"menu.mark_page_as_read": "Diese Seite als gelesen markieren", "menu.mark_page_as_read": "Diese Seite als gelesen markieren",
"menu.mark_all_as_read": "Alle als gelesen markieren", "menu.mark_all_as_read": "Alle als gelesen markieren",
"menu.mark_all_as_read_wip": "In Arbeit...",
"menu.show_all_entries": "Zeige alle Artikel", "menu.show_all_entries": "Zeige alle Artikel",
"menu.show_only_unread_entries": "Nur ungelesene Artikel anzeigen", "menu.show_only_unread_entries": "Nur ungelesene Artikel anzeigen",
"menu.refresh_feed": "Aktualisieren", "menu.refresh_feed": "Aktualisieren",

View file

@ -33,7 +33,6 @@
"menu.create_category": "Create a category", "menu.create_category": "Create a category",
"menu.mark_page_as_read": "Mark this page as read", "menu.mark_page_as_read": "Mark this page as read",
"menu.mark_all_as_read": "Mark all as read", "menu.mark_all_as_read": "Mark all as read",
"menu.mark_all_as_read_wip": "Operation in progress...",
"menu.show_all_entries": "Show all entries", "menu.show_all_entries": "Show all entries",
"menu.show_only_unread_entries": "Show only unread entries", "menu.show_only_unread_entries": "Show only unread entries",
"menu.refresh_feed": "Refresh", "menu.refresh_feed": "Refresh",

View file

@ -33,7 +33,6 @@
"menu.create_category": "Crear una categoría", "menu.create_category": "Crear una categoría",
"menu.mark_page_as_read": "Marcar esta pagína como leída", "menu.mark_page_as_read": "Marcar esta pagína como leída",
"menu.mark_all_as_read": "Marcar todos como leídos", "menu.mark_all_as_read": "Marcar todos como leídos",
"menu.mark_all_as_read_wip": "Operación en progreso...",
"menu.show_all_entries": "Mostrar todas las entradas", "menu.show_all_entries": "Mostrar todas las entradas",
"menu.show_only_unread_entries": "Mostrar solo las entradas no leídas", "menu.show_only_unread_entries": "Mostrar solo las entradas no leídas",
"menu.refresh_feed": "Refrescar", "menu.refresh_feed": "Refrescar",

View file

@ -33,7 +33,6 @@
"menu.create_category": "Créer une catégorie", "menu.create_category": "Créer une catégorie",
"menu.mark_page_as_read": "Marquer cette page comme lu", "menu.mark_page_as_read": "Marquer cette page comme lu",
"menu.mark_all_as_read": "Tout marquer comme lu", "menu.mark_all_as_read": "Tout marquer comme lu",
"menu.mark_all_as_read_wip": "Opération en cours...",
"menu.show_all_entries": "Afficher tous les articles", "menu.show_all_entries": "Afficher tous les articles",
"menu.show_only_unread_entries": "Afficher uniquement les articles non lus", "menu.show_only_unread_entries": "Afficher uniquement les articles non lus",
"menu.refresh_feed": "Actualiser", "menu.refresh_feed": "Actualiser",

View file

@ -33,7 +33,6 @@
"menu.create_category": "Aggiungi una categoria", "menu.create_category": "Aggiungi una categoria",
"menu.mark_page_as_read": "Segna questa pagina come letta", "menu.mark_page_as_read": "Segna questa pagina come letta",
"menu.mark_all_as_read": "Segna tutti gli articoli come letti", "menu.mark_all_as_read": "Segna tutti gli articoli come letti",
"menu.mark_all_as_read_wip": "Operazione in corso...",
"menu.show_all_entries": "Mostra tutte le voci", "menu.show_all_entries": "Mostra tutte le voci",
"menu.show_only_unread_entries": "Mostra solo voci non lette", "menu.show_only_unread_entries": "Mostra solo voci non lette",
"menu.refresh_feed": "Aggiorna", "menu.refresh_feed": "Aggiorna",

View file

@ -33,7 +33,6 @@
"menu.create_category": "Categorie toevoegen", "menu.create_category": "Categorie toevoegen",
"menu.mark_page_as_read": "Markeer deze pagina als gelezen", "menu.mark_page_as_read": "Markeer deze pagina als gelezen",
"menu.mark_all_as_read": "Markeer alle items als gelezen", "menu.mark_all_as_read": "Markeer alle items als gelezen",
"menu.mark_all_as_read_wip": "Bezig...",
"menu.show_all_entries": "Toon alle artikelen", "menu.show_all_entries": "Toon alle artikelen",
"menu.show_only_unread_entries": "Toon alleen ongelezen artikelen", "menu.show_only_unread_entries": "Toon alleen ongelezen artikelen",
"menu.refresh_feed": "Vernieuwen", "menu.refresh_feed": "Vernieuwen",

View file

@ -33,7 +33,6 @@
"menu.create_category": "Utwórz kategorię", "menu.create_category": "Utwórz kategorię",
"menu.mark_page_as_read": "Oznacz jako przeczytane", "menu.mark_page_as_read": "Oznacz jako przeczytane",
"menu.mark_all_as_read": "Oznacz wszystko jako przeczytane", "menu.mark_all_as_read": "Oznacz wszystko jako przeczytane",
"menu.mark_all_as_read_wip": "W toku...",
"menu.show_all_entries": "Pokaż wszystkie artykuły", "menu.show_all_entries": "Pokaż wszystkie artykuły",
"menu.show_only_unread_entries": "Pokaż tylko nieprzeczytane artykuły", "menu.show_only_unread_entries": "Pokaż tylko nieprzeczytane artykuły",
"menu.refresh_feed": "Odśwież", "menu.refresh_feed": "Odśwież",

View file

@ -33,7 +33,6 @@
"menu.create_category": "Создать категорию", "menu.create_category": "Создать категорию",
"menu.mark_page_as_read": "Отметить эту страницу прочитанной", "menu.mark_page_as_read": "Отметить эту страницу прочитанной",
"menu.mark_all_as_read": "Отметить всё как прочитанное", "menu.mark_all_as_read": "Отметить всё как прочитанное",
"menu.mark_all_as_read_wip": "В процессе…",
"menu.show_all_entries": "Показать все статьи", "menu.show_all_entries": "Показать все статьи",
"menu.show_only_unread_entries": "Показывать только непрочитанные статьи", "menu.show_only_unread_entries": "Показывать только непрочитанные статьи",
"menu.refresh_feed": "Обновить", "menu.refresh_feed": "Обновить",

View file

@ -33,7 +33,6 @@
"menu.create_category": "新建分类", "menu.create_category": "新建分类",
"menu.mark_page_as_read": "标记为已读", "menu.mark_page_as_read": "标记为已读",
"menu.mark_all_as_read": "全部标为已读", "menu.mark_all_as_read": "全部标为已读",
"menu.mark_all_as_read_wip": "执行中…",
"menu.show_all_entries": "显示所有条目", "menu.show_all_entries": "显示所有条目",
"menu.show_only_unread_entries": "仅显示未读文章", "menu.show_only_unread_entries": "仅显示未读文章",
"menu.refresh_feed": "更新", "menu.refresh_feed": "更新",

View file

@ -14,9 +14,14 @@
data-label-loading="{{ t "confirm.loading" }}">{{ t "menu.mark_page_as_read" }}</a> data-label-loading="{{ t "confirm.loading" }}">{{ t "menu.mark_page_as_read" }}</a>
</li> </li>
<li> <li>
<a data-link-state="flip" <a href="#"
data-label-new-state="{{ t "menu.mark_all_as_read_wip" }}" data-confirm="true"
href="{{ route "markAllAsRead" }}">{{ t "menu.mark_all_as_read" }}</a> data-url="{{ route "markAllAsRead" }}"
data-redirect-url="{{ route "unread" }}"
data-label-question="{{ t "confirm.question" }}"
data-label-yes="{{ t "confirm.yes" }}"
data-label-no="{{ t "confirm.no" }}"
data-label-loading="{{ t "confirm.loading" }}">{{ t "menu.mark_all_as_read" }}</a>
</li> </li>
</ul> </ul>
{{ end }} {{ end }}

View file

@ -1335,9 +1335,14 @@ var templateViewsMap = map[string]string{
data-label-loading="{{ t "confirm.loading" }}">{{ t "menu.mark_page_as_read" }}</a> data-label-loading="{{ t "confirm.loading" }}">{{ t "menu.mark_page_as_read" }}</a>
</li> </li>
<li> <li>
<a data-link-state="flip" <a href="#"
data-label-new-state="{{ t "menu.mark_all_as_read_wip" }}" data-confirm="true"
href="{{ route "markAllAsRead" }}">{{ t "menu.mark_all_as_read" }}</a> data-url="{{ route "markAllAsRead" }}"
data-redirect-url="{{ route "unread" }}"
data-label-question="{{ t "confirm.question" }}"
data-label-yes="{{ t "confirm.yes" }}"
data-label-no="{{ t "confirm.no" }}"
data-label-loading="{{ t "confirm.loading" }}">{{ t "menu.mark_all_as_read" }}</a>
</li> </li>
</ul> </ul>
{{ end }} {{ end }}
@ -1468,6 +1473,6 @@ var templateViewsMapChecksums = map[string]string{
"search_entries": "d71849a4f2b0573c7c76ad0ea941812009e9f022de60895987a781d3e6f08a01", "search_entries": "d71849a4f2b0573c7c76ad0ea941812009e9f022de60895987a781d3e6f08a01",
"sessions": "1b3ec0970a4111b81f86d6ed187bb410f88972e2ede6723b9febcc4c7e5fc921", "sessions": "1b3ec0970a4111b81f86d6ed187bb410f88972e2ede6723b9febcc4c7e5fc921",
"settings": "152143e58d057ea6ab3bfd8dd947bfd70685843ca40e40542484b23849746df4", "settings": "152143e58d057ea6ab3bfd8dd947bfd70685843ca40e40542484b23849746df4",
"unread_entries": "5d23dc604496bcfa5ddfd1f5b8693aa5d94d2faa10979d04983e8bd8c7de36e9", "unread_entries": "5c8c67d69da3e1d9437fdae967206b6dec84b241c806f32373071558f72d05d7",
"users": "4b56cc76fbcc424e7c870d0efca93bb44dbfcc2a08b685cf799c773fbb8dfb2f", "users": "4b56cc76fbcc424e7c870d0efca93bb44dbfcc2a08b685cf799c773fbb8dfb2f",
} }

File diff suppressed because one or more lines are too long

View file

@ -37,10 +37,6 @@ a:hover {
text-decoration: none; text-decoration: none;
} }
.link-flipped-state {
font-style: italic;
}
/* Header and main menu */ /* Header and main menu */
.header { .header {
margin-top: 10px; margin-top: 10px;

View file

@ -96,16 +96,15 @@ function incrementUnreadCounter(n){updateUnreadCounterValue((current)=>{return c
function updateUnreadCounterValue(callback){let counterElements=document.querySelectorAll("span.unread-counter");counterElements.forEach((element)=>{let oldValue=parseInt(element.textContent,10);element.innerHTML=callback(oldValue);});if(window.location.href.endsWith('/unread')){let oldValue=parseInt(document.title.split('(')[1],10);let newValue=callback(oldValue);document.title=document.title.replace(/(.*?)\(\d+\)(.*?)/,function(match,prefix,suffix,offset,string){return prefix+'('+newValue+')'+suffix;});}} function updateUnreadCounterValue(callback){let counterElements=document.querySelectorAll("span.unread-counter");counterElements.forEach((element)=>{let oldValue=parseInt(element.textContent,10);element.innerHTML=callback(oldValue);});if(window.location.href.endsWith('/unread')){let oldValue=parseInt(document.title.split('(')[1],10);let newValue=callback(oldValue);document.title=document.title.replace(/(.*?)\(\d+\)(.*?)/,function(match,prefix,suffix,offset,string){return prefix+'('+newValue+')'+suffix;});}}
function isEntry(){return document.querySelector("section.entry")!==null;} function isEntry(){return document.querySelector("section.entry")!==null;}
function isListView(){return document.querySelector(".items")!==null;} function isListView(){return document.querySelector(".items")!==null;}
function flipElementState(element){let labelElement=document.createElement("span");labelElement.className="link-flipped-state";labelElement.appendChild(document.createTextNode(element.dataset.labelNewState));element.parentNode.appendChild(labelElement);element.parentNode.removeChild(element);}
function handleConfirmationMessage(linkElement,callback){linkElement.style.display="none";let containerElement=linkElement.parentNode;let questionElement=document.createElement("span");let yesElement=document.createElement("a");yesElement.href="#";yesElement.appendChild(document.createTextNode(linkElement.dataset.labelYes));yesElement.onclick=(event)=>{event.preventDefault();let loadingElement=document.createElement("span");loadingElement.className="loading";loadingElement.appendChild(document.createTextNode(linkElement.dataset.labelLoading));questionElement.remove();containerElement.appendChild(loadingElement);callback(linkElement.dataset.url,linkElement.dataset.redirectUrl);};let noElement=document.createElement("a");noElement.href="#";noElement.appendChild(document.createTextNode(linkElement.dataset.labelNo));noElement.onclick=(event)=>{event.preventDefault();linkElement.style.display="inline";questionElement.remove();};questionElement.className="confirm";questionElement.appendChild(document.createTextNode(linkElement.dataset.labelQuestion+" "));questionElement.appendChild(yesElement);questionElement.appendChild(document.createTextNode(", "));questionElement.appendChild(noElement);containerElement.appendChild(questionElement);} function handleConfirmationMessage(linkElement,callback){linkElement.style.display="none";let containerElement=linkElement.parentNode;let questionElement=document.createElement("span");let yesElement=document.createElement("a");yesElement.href="#";yesElement.appendChild(document.createTextNode(linkElement.dataset.labelYes));yesElement.onclick=(event)=>{event.preventDefault();let loadingElement=document.createElement("span");loadingElement.className="loading";loadingElement.appendChild(document.createTextNode(linkElement.dataset.labelLoading));questionElement.remove();containerElement.appendChild(loadingElement);callback(linkElement.dataset.url,linkElement.dataset.redirectUrl);};let noElement=document.createElement("a");noElement.href="#";noElement.appendChild(document.createTextNode(linkElement.dataset.labelNo));noElement.onclick=(event)=>{event.preventDefault();linkElement.style.display="inline";questionElement.remove();};questionElement.className="confirm";questionElement.appendChild(document.createTextNode(linkElement.dataset.labelQuestion+" "));questionElement.appendChild(yesElement);questionElement.appendChild(document.createTextNode(", "));questionElement.appendChild(noElement);containerElement.appendChild(questionElement);}
document.addEventListener("DOMContentLoaded",function(){handleSubmitButtons();if(!document.querySelector("body[data-disable-keyboard-shortcuts=true]")){let keyboardHandler=new KeyboardHandler();keyboardHandler.on("g u",()=>goToPage("unread"));keyboardHandler.on("g b",()=>goToPage("starred"));keyboardHandler.on("g h",()=>goToPage("history"));keyboardHandler.on("g f",()=>goToFeedOrFeeds());keyboardHandler.on("g c",()=>goToPage("categories"));keyboardHandler.on("g s",()=>goToPage("settings"));keyboardHandler.on("ArrowLeft",()=>goToPrevious());keyboardHandler.on("ArrowRight",()=>goToNext());keyboardHandler.on("k",()=>goToPrevious());keyboardHandler.on("p",()=>goToPrevious());keyboardHandler.on("j",()=>goToNext());keyboardHandler.on("n",()=>goToNext());keyboardHandler.on("h",()=>goToPage("previous"));keyboardHandler.on("l",()=>goToPage("next"));keyboardHandler.on("o",()=>openSelectedItem());keyboardHandler.on("v",()=>openOriginalLink());keyboardHandler.on("m",()=>handleEntryStatus());keyboardHandler.on("A",()=>markPageAsRead());keyboardHandler.on("s",()=>handleSaveEntry());keyboardHandler.on("d",()=>handleFetchOriginalContent());keyboardHandler.on("f",()=>handleBookmark());keyboardHandler.on("?",()=>showKeyboardShortcuts());keyboardHandler.on("#",()=>unsubscribeFromFeed());keyboardHandler.on("/",(e)=>setFocusToSearchInput(e));keyboardHandler.on("Escape",()=>ModalHandler.close());keyboardHandler.listen();} document.addEventListener("DOMContentLoaded",function(){handleSubmitButtons();if(!document.querySelector("body[data-disable-keyboard-shortcuts=true]")){let keyboardHandler=new KeyboardHandler();keyboardHandler.on("g u",()=>goToPage("unread"));keyboardHandler.on("g b",()=>goToPage("starred"));keyboardHandler.on("g h",()=>goToPage("history"));keyboardHandler.on("g f",()=>goToFeedOrFeeds());keyboardHandler.on("g c",()=>goToPage("categories"));keyboardHandler.on("g s",()=>goToPage("settings"));keyboardHandler.on("ArrowLeft",()=>goToPrevious());keyboardHandler.on("ArrowRight",()=>goToNext());keyboardHandler.on("k",()=>goToPrevious());keyboardHandler.on("p",()=>goToPrevious());keyboardHandler.on("j",()=>goToNext());keyboardHandler.on("n",()=>goToNext());keyboardHandler.on("h",()=>goToPage("previous"));keyboardHandler.on("l",()=>goToPage("next"));keyboardHandler.on("o",()=>openSelectedItem());keyboardHandler.on("v",()=>openOriginalLink());keyboardHandler.on("m",()=>handleEntryStatus());keyboardHandler.on("A",()=>markPageAsRead());keyboardHandler.on("s",()=>handleSaveEntry());keyboardHandler.on("d",()=>handleFetchOriginalContent());keyboardHandler.on("f",()=>handleBookmark());keyboardHandler.on("?",()=>showKeyboardShortcuts());keyboardHandler.on("#",()=>unsubscribeFromFeed());keyboardHandler.on("/",(e)=>setFocusToSearchInput(e));keyboardHandler.on("Escape",()=>ModalHandler.close());keyboardHandler.listen();}
let touchHandler=new TouchHandler();touchHandler.listen();onClick("a[data-save-entry]",()=>handleSaveEntry());onClick("a[data-toggle-bookmark]",()=>handleBookmark());onClick("a[data-fetch-content-entry]",()=>handleFetchOriginalContent());onClick("a[data-action=search]",(event)=>setFocusToSearchInput(event));onClick("a[data-action=markPageAsRead]",()=>handleConfirmationMessage(event.target,()=>markPageAsRead()));onClick("a[data-toggle-status]",(event)=>{let currentItem=DomHelper.findParent(event.target,"entry");if(!currentItem){currentItem=DomHelper.findParent(event.target,"item");} let touchHandler=new TouchHandler();touchHandler.listen();onClick("a[data-save-entry]",()=>handleSaveEntry());onClick("a[data-toggle-bookmark]",()=>handleBookmark());onClick("a[data-fetch-content-entry]",()=>handleFetchOriginalContent());onClick("a[data-action=search]",(event)=>setFocusToSearchInput(event));onClick("a[data-action=markPageAsRead]",()=>handleConfirmationMessage(event.target,()=>markPageAsRead()));onClick("a[data-toggle-status]",(event)=>{let currentItem=DomHelper.findParent(event.target,"entry");if(!currentItem){currentItem=DomHelper.findParent(event.target,"item");}
if(currentItem){toggleEntryStatus(currentItem);}});onClick("a[data-confirm]",(event)=>handleConfirmationMessage(event.target,(url,redirectURL)=>{let request=new RequestBuilder(url);request.withCallback(()=>{if(redirectURL){window.location.href=redirectURL;}else{window.location.reload();}});request.execute();}));onClick("a[data-link-state=flip]",(event)=>{flipElementState(event.target);},true);if(document.documentElement.clientWidth<600){onClick(".logo",()=>toggleMainMenu());onClick(".header nav li",(event)=>onClickMainMenuListItem(event));} if(currentItem){toggleEntryStatus(currentItem);}});onClick("a[data-confirm]",(event)=>handleConfirmationMessage(event.target,(url,redirectURL)=>{let request=new RequestBuilder(url);request.withCallback(()=>{if(redirectURL){window.location.href=redirectURL;}else{window.location.reload();}});request.execute();}));if(document.documentElement.clientWidth<600){onClick(".logo",()=>toggleMainMenu());onClick(".header nav li",(event)=>onClickMainMenuListItem(event));}
if("serviceWorker"in navigator){let scriptElement=document.getElementById("service-worker-script");if(scriptElement){navigator.serviceWorker.register(scriptElement.src);}}});})();`, if("serviceWorker"in navigator){let scriptElement=document.getElementById("service-worker-script");if(scriptElement){navigator.serviceWorker.register(scriptElement.src);}}});})();`,
"sw": `'use strict';self.addEventListener("fetch",(event)=>{if(event.request.url.includes("/feed/icon/")){event.respondWith(caches.open("feed_icons").then((cache)=>{return cache.match(event.request).then((response)=>{return response||fetch(event.request).then((response)=>{cache.put(event.request,response.clone());return response;});});}));}});`, "sw": `'use strict';self.addEventListener("fetch",(event)=>{if(event.request.url.includes("/feed/icon/")){event.respondWith(caches.open("feed_icons").then((cache)=>{return cache.match(event.request).then((response)=>{return response||fetch(event.request).then((response)=>{cache.put(event.request,response.clone());return response;});});}));}});`,
} }
var JavascriptsChecksums = map[string]string{ var JavascriptsChecksums = map[string]string{
"app": "bf306e93b04662c7ecc975c54e2ce4b1a4ed76d23ea2e708da70fb8371f368b8", "app": "7220905bf67e3283f975da171548d2622160d52ba07ed17933a7c38f41d83caa",
"sw": "55fffa223919cc18572788fb9c62fccf92166c0eb5d3a1d6f91c31f24d020be9", "sw": "55fffa223919cc18572788fb9c62fccf92166c0eb5d3a1d6f91c31f24d020be9",
} }

View file

@ -454,15 +454,6 @@ function isListView() {
return document.querySelector(".items") !== null; return document.querySelector(".items") !== null;
} }
function flipElementState(element) {
let labelElement = document.createElement("span");
labelElement.className = "link-flipped-state";
labelElement.appendChild(document.createTextNode(element.dataset.labelNewState));
element.parentNode.appendChild(labelElement);
element.parentNode.removeChild(element);
}
function handleConfirmationMessage(linkElement, callback) { function handleConfirmationMessage(linkElement, callback) {
linkElement.style.display = "none"; linkElement.style.display = "none";

View file

@ -65,10 +65,6 @@ document.addEventListener("DOMContentLoaded", function () {
request.execute(); request.execute();
})); }));
onClick("a[data-link-state=flip]", (event) => {
flipElementState(event.target);
}, true);
if (document.documentElement.clientWidth < 600) { if (document.documentElement.clientWidth < 600) {
onClick(".logo", () => toggleMainMenu()); onClick(".logo", () => toggleMainMenu());
onClick(".header nav li", (event) => onClickMainMenuListItem(event)); onClick(".header nav li", (event) => onClickMainMenuListItem(event));

View file

@ -38,7 +38,7 @@ func Serve(router *mux.Router, store *storage.Storage, pool *worker.Pool, feedHa
uiRouter.HandleFunc("/bookmarklet", handler.bookmarklet).Name("bookmarklet").Methods("GET") uiRouter.HandleFunc("/bookmarklet", handler.bookmarklet).Name("bookmarklet").Methods("GET")
// Unread page. // Unread page.
uiRouter.HandleFunc("/mark-all-as-read", handler.markAllAsRead).Name("markAllAsRead").Methods("GET") uiRouter.HandleFunc("/mark-all-as-read", handler.markAllAsRead).Name("markAllAsRead").Methods("POST")
uiRouter.HandleFunc("/unread", handler.showUnreadPage).Name("unread").Methods("GET") uiRouter.HandleFunc("/unread", handler.showUnreadPage).Name("unread").Methods("GET")
uiRouter.HandleFunc("/unread/entry/{entryID}", handler.showUnreadEntryPage).Name("unreadEntry").Methods("GET") uiRouter.HandleFunc("/unread/entry/{entryID}", handler.showUnreadEntryPage).Name("unreadEntry").Methods("GET")

View file

@ -8,15 +8,14 @@ import (
"net/http" "net/http"
"miniflux.app/http/request" "miniflux.app/http/request"
"miniflux.app/http/response/html" "miniflux.app/http/response/json"
"miniflux.app/http/route"
"miniflux.app/logger"
) )
func (h *handler) markAllAsRead(w http.ResponseWriter, r *http.Request) { func (h *handler) markAllAsRead(w http.ResponseWriter, r *http.Request) {
if err := h.store.MarkAllAsRead(request.UserID(r)); err != nil { if err := h.store.MarkAllAsRead(request.UserID(r)); err != nil {
logger.Error("[MarkAllAsRead] %v", err) json.ServerError(w, r, err)
return
} }
html.Redirect(w, r, route.Path(h.router, "unread")) json.OK(w, r, "OK")
} }