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

Tags in URL for short access #1407

Open
Wikibear opened this issue Nov 30, 2024 · 1 comment
Open

Tags in URL for short access #1407

Wikibear opened this issue Nov 30, 2024 · 1 comment

Comments

@Wikibear
Copy link

Wikibear commented Nov 30, 2024

I like Heimdall but i want to like have direct access to tags if I'm in category mode. I wrote a small script, but i feel to start a discussion that it maybe make more sense to implement this into the custom app.js.

` $(document).ready(function() {

function getParameterByName(tag, url) {
    if (!url) url = window.location.href;
    tag = encodeURIComponent(tag).replace(/[\[\]]/g, "\$&");
    var regex = new RegExp("[?&]" + tag + "(=([^&#]*)|&|#|$)"), results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, " "));
}

function hideShowBlocks(tag) {
    $('section.item-container').hide();
    $('.tag[data-tag="all"]').removeClass('current');
    $('.tag.link.white[data-tag="tag-' + tag + '"]').addClass('current');
    $('section.item-container.tag-' + tag).show();
}

let tag = getParameterByName('tag');
if(tag === "Home Dashboard"){
    console.log("Home Dashboard new into");
    tag = "0-dash";
}
if (tag) {
    tag = tag.replace(/_/g, '-').toLowerCase();
    setTimeout(function() { hideShowBlocks(tag); }, 200); 
}

$('body').on('click', '[data-tag]', function() {
    const tagText = $(this).text().trim();
    const newUrl = window.location.origin + window.location.pathname + '?tag=' + encodeURIComponent(tagText);
    history.pushState(null, '', newUrl);
});

});`

Short explanation:

If you click on a category in header, you get the URL like ?tag=cat1 . Now you can choose exactly this URL and you get this page with this category directly. I like it very much. But it's more a hack.

Maybe you are interested in this.

@LinuxServer-CI
Copy link

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Non-Docker Issues
Development

No branches or pull requests

2 participants