-
Notifications
You must be signed in to change notification settings - Fork 15
Tools page customization #508
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
base: dev
Are you sure you want to change the base?
Changes from 3 commits
2d1420a
aaf59b1
3cfe320
371f108
231818f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1609,7 +1609,7 @@ | |
| // Description: Hides the Community Bulletin module from the sidebar | ||
|
|
||
| const element = document.querySelector('#sidebar .s-sidebarwidget'); | ||
| if (element.innerText.contains('The Overflow Blog')) element.remove(); | ||
| if (element?.innerText.contains('The Overflow Blog')) element.remove(); | ||
| }, | ||
|
|
||
| hideJustHotMetaPosts: function() { | ||
|
|
@@ -2620,6 +2620,26 @@ | |
| const answers = document.querySelector("#answers-header h2").innerText.split(' ')[0]; | ||
| const toInsert = '<div class="grid--cell ws-nowrap mb8 ml16"><span class="fc-light mr4">Answers</span> ' + answers + '</div>'; | ||
| document.querySelector(".d-flex.fw-wrap").insertAdjacentHTML("beforeEnd", toInsert); | ||
| } | ||
| }, | ||
|
|
||
| customizeToolsPageLists: function(settings) { | ||
| const trimLists = function(table) { | ||
| if (settings.filterInvalid) { | ||
| table.querySelectorAll("td.tagged-ignored").forEach(cell => cell.parentNode.remove()); | ||
| } | ||
| if (settings.filterTypeQuestions) { | ||
| table.querySelectorAll("a.question-hyperlink").forEach(cell => cell.parentNode.parentNode.remove()); | ||
| } | ||
| if (settings.filterTypeAnswers) { | ||
| table.querySelectorAll("a.answer-hyperlink").forEach(cell => cell.parentNode.parentNode.remove()); | ||
| } | ||
| const listCount = settings.listCount || 3; | ||
| const rows = table.querySelectorAll("tr"); | ||
| rows.forEach((row, i) => row.classList.toggle("collapsing", i >= listCount)); | ||
| }; | ||
| // tables are populated by XHR after page loads | ||
| sox.helpers.observe(Array.from(document.querySelectorAll("div.island")), "table.summary-table", trimLists); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could replace this with we found that the advantage of doing it this way is we stop adding so many mutation observers to the page, which seemed to have negative performance effects when there were too many. This method instead just triggers your function whenever an xhr response from the given URL is received, after which we can query for the table once |
||
| // just in case we come in after a table has been loaded already | ||
| document.querySelectorAll("table.summary-table").forEach(table => trimLists(table)); | ||
| }; | ||
|
miken32 marked this conversation as resolved.
|
||
| })(window.sox = window.sox || {}, jQuery); | ||
Uh oh!
There was an error while loading. Please reload this page.