Skip to content

Commit

Permalink
feat: major internal restructuring and improved content handling
Browse files Browse the repository at this point in the history
  • Loading branch information
3choff committed Nov 25, 2024
1 parent 6a71c33 commit e2df127
Show file tree
Hide file tree
Showing 16 changed files with 1,806 additions and 860 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ node_modules
coverage
*.log
changes.txt
*.md
!README.md
!CHANGELOG.md
7 changes: 6 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ vsc-extension-quickstart.md
.github/**
images/**
node_modules/**
changes.txt

# Keep only essential Puppeteer files
!node_modules/puppeteer-core/lib/cjs/**
Expand All @@ -29,4 +30,8 @@ node_modules/**
**/examples/**
**/.github/**
**/.vscode/**
**/coverage/**
**/coverage/**

# Explicitly keep important markdown files
!CHANGELOG.md
!README.md
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

## [1.3.0] - 2024-11-24

### Added
- Major internal refactoring for improved code maintainability
- Enhanced error handling and reporting
- Dedicated service architecture for better separation of concerns
- Improved type safety throughout the codebase
- Better content cleaning and formatting:
- Enhanced SVG handling in browser method
- Improved navigation and footer removal
- Fixed JSON file formatting in GitHub repository crawling
- Added non-text file skipping in repository crawling

## [1.2.0] - 2024-11-22

### Added
Expand Down
3 changes: 2 additions & 1 deletion media/webview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="${stylesUri}">
<link rel="stylesheet" href="${styleUri}">
</head>
<body>
<div class="url-input">
Expand All @@ -15,6 +15,7 @@
<option value="api">API (Faster but may fail on some sites)</option>
<option value="browser">Browser (Slower but more reliable)</option>
</select>
<div id="githubNotice" class="github-notice">GitHub repository detected. Using a specialized crawling method</div>
</div>
<div class="section-container">
<div class="section-label">Set the depth of crawling</div>
Expand Down
22 changes: 22 additions & 0 deletions media/webview/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,34 @@ function validateUrl(url) {
}
}

function isGithubUrl(url) {
try {
const urlObj = new URL(url);
return urlObj.hostname === 'github.com';
} catch {
return false;
}
}

function updateMethodDropdown(url) {
const isGithub = isGithubUrl(url);
ELEMENTS.crawlerMethod.disabled = isGithub;
ELEMENTS.crawlerMethod.closest('.crawler-method').classList.toggle('github-mode', isGithub);
}

ELEMENTS.depthSlider.addEventListener('input', (e) => {
const depth = parseInt(e.target.value);
ELEMENTS.depthValue.textContent = depth;
ELEMENTS.depthDescription.textContent = DEPTH_DESCRIPTIONS[depth] || '';
});

ELEMENTS.urlInput.addEventListener('input', (e) => {
const url = e.target.value.trim();
if (url) {
updateMethodDropdown(url);
}
});

ELEMENTS.startButton.addEventListener('click', () => {
const url = ELEMENTS.urlInput.value.trim();
if (!validateUrl(url)) return;
Expand Down
14 changes: 14 additions & 0 deletions media/webview/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,21 @@ input[type="range"]:focus {
.crawler-method select:focus {
border-color: var(--input-focus-border);
}
.github-notice {
display: none;
font-size: 0.9em;
color: var(--vscode-descriptionForeground);
margin-top: 4px;
font-style: italic;
}

.crawler-method.github-mode .github-notice {
display: block;
}

.crawler-method.github-mode #crawlerMethod {
opacity: 0.7;
}
.depth-control {
margin: 0px;
padding: 10px;
Expand Down
Loading

0 comments on commit e2df127

Please # to comment.