fossar / selfoss

multipurpose rss reader, live stream, mashup, aggregation web application
https://selfoss.aditu.de
GNU General Public License v3.0
2.35k stars 343 forks source link

Open Link instead of expand the Item? #1411

Open spec1re opened 1 year ago

spec1re commented 1 year ago

Is it possible to somehow just open the the link instead of expanding it, like clicking on the favicon or datetime?

jtojnar commented 1 year ago

There is currently no configuration option. You could probably add some code to user.js for now. (I can come up with something later if you want.)

It might be interesting to implement some kind of event-action system that would allow remapping the item:activate action to open-link.

spec1re commented 1 year ago

There is currently no configuration option. You could probably add some code to user.js for now. (I can come up with something later if you want.)

It might be interesting to implement some kind of event-action system that would allow remapping the item:activate action to open-link.

That would be awesome! Thanks.

I really like Selfoss, I would like to see a "light" mode, no content just links to the news. This would be more consistent, just open a new tab.

spec1re commented 1 year ago

How do I do it with user.js? Sorry zero JS knowledge here an quick example would be fine.

Thanks.

jtojnar commented 1 year ago

This is ugly but seems to work:

function openEntryLink(id) {
    window.open(document.querySelector(`.entry[data-entry-id="${id}"]`).getAttribute('data-entry-url'));
}

const entriesPageNotifier = {
    set: function(obj, prop, value) {
        console.log(obj, prop, value)
        obj[prop] = value;

        if (prop === 'entriesPage' && value !== null) {
            value.activateEntry = openEntryLink;
        }

        return true;
    }
};

selfoss = new Proxy(selfoss, entriesPageNotifier);

if (selfoss.entriesPage !== null && selfoss.entriesPage.activateEntry !== openEntryLink) {
    selfoss.entriesPage.activateEntry = openEntryLink;
}
spec1re commented 1 year ago

@jtojnar

No this is beautiful and fully serves the purpose.

Thank you very much, much appreciated!

spec1re commented 1 year ago
 function openEntryLink(id) {
     window.open(document.querySelector(`.entry[data-entry-id="${id}"]`).getAttribute('data-entry-url'));
    document.getElementById("currentpage").innerHTML = window.location.replace;
 }

 const entriesPageNotifier = {
     set: function(obj, prop, value) {
         console.log(obj, prop, value)
         obj[prop] = value;

         if (prop === 'entriesPage' && value !== null) {
             value.activateEntry = openEntryLink;
         }

         return true;
     }
 };

 selfoss = new Proxy(selfoss, entriesPageNotifier);

 if (selfoss.entriesPage !== null && selfoss.entriesPage.activateEntry !== openEntryLink) {
     selfoss.entriesPage.activateEntry = openEntryLink;
 }

Just a litte edit, makes the page url stay and don't change to the item id.