Skip to content

Commit

Permalink
build: Made refreshing the page stay on the current tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmiscool committed Jan 4, 2025
1 parent d254d31 commit 5d1d484
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .aiCoder/llmConfig/ai-service.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
openai
ollama
12 changes: 9 additions & 3 deletions public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ let ctx = {};


async function setup() {
// Extract the hash from the URL
const hashText = window.location.hash;
let extractedText = await hashText.startsWith('#') ? hashText.substring(1) : hashText;
// turn the extracted text back in to plain text
extractedText = await decodeURIComponent(extractedText);
//alert(extractedText);

ctx.autoApplyTimeout = 10;
const tabs = new tabInterface();
ctx.tabs = tabs;
Expand All @@ -32,11 +39,10 @@ async function setup() {
document.body.appendChild(tabs.getElement());
window.ctx = ctx;

// Extract the hash from the URL
const hashText = window.location.hash;


// Remove the leading '#' if it exists
const extractedText = await hashText.startsWith('#') ? hashText.substring(1) : hashText;

tabs.switchToTab(extractedText);

}
Expand Down
2 changes: 1 addition & 1 deletion public/tabInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class tabInterface {
}
}
showActiveTab() {
window.location.hash = this.activeTab;
window.location.hash = this.tabs[this.activeTab].name;
// alert(tabName);
// Clear the content area
this.contentArea.innerHTML = '';
Expand Down

0 comments on commit 5d1d484

Please sign in to comment.