Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Link instead of expand the Item? #1411

Open
spec1re opened this issue Feb 12, 2023 · 6 comments
Open

Open Link instead of expand the Item? #1411

spec1re opened this issue Feb 12, 2023 · 6 comments

Comments

@spec1re
Copy link

spec1re commented Feb 12, 2023

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

@jtojnar
Copy link
Member

jtojnar commented Feb 12, 2023

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
Copy link
Author

spec1re commented Feb 12, 2023

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
Copy link
Author

spec1re commented Feb 14, 2023

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

Thanks.

@jtojnar
Copy link
Member

jtojnar commented Feb 14, 2023

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
Copy link
Author

spec1re commented Feb 14, 2023

@jtojnar

No this is beautiful and fully serves the purpose.

Thank you very much, much appreciated!

@spec1re
Copy link
Author

spec1re commented Feb 16, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants