8000 Cannot quote on pages before last one on non-archived threads. · Issue #8 · cpluspluscom/EnhancedCpp.com · GitHub
[go: up one dir, main page]

Skip to content
Cannot quote on pages before last one on non-archived threads. #8
Closed
@rgajrawala

Description

@rgajrawala

For example, this thread is recent and is not archived yet. However, the Quote buttons do not show on the first page, only the last...

You can check if a topic is archived or not by testing the length of document.querySelector('#CH_subscription > form > select').children. If the number of children is greater than two, the thread isn't archived.

When a Quote button is pressed:

var pages = document.querySelector('.C_pages');
var on_last_page = pages ? !!pages.lastChild.title : true;
if (on_last_page) {
    // Show the quote normally, we are already on the last page...
} else {
    // Save the quote in storage since we are going to jump to the last page...
    // Also save the thread ID for later checking...
    window.location.href = pages.lastChild.href;
}

When the user is redirected to the last page:

if (/* quote is set in storage */ && /* thread ID in storage matches this threadID */ && document.getElementById('CH_reply')) {
    // Automatically set up reply with the quote...
}
// Clear quote and thread ID in storage...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0