diff --git a/.gitignore b/.gitignore index 40b878d..c06c56b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -node_modules/ \ No newline at end of file +node_modules/ +.kiro/ +.vscode/ \ No newline at end of file diff --git a/.kiro/specs/copy-to-clipboard-toggle/design.md b/.kiro/specs/copy-to-clipboard-toggle/design.md deleted file mode 100644 index 7d4af9a..0000000 --- a/.kiro/specs/copy-to-clipboard-toggle/design.md +++ /dev/null @@ -1,165 +0,0 @@ -# Design Document - -## Overview - -The copy to clipboard toggle feature will be implemented as an additional setting in the extension popup, similar to the existing background color selector. The feature will use the modern Clipboard API with appropriate fallbacks for older browsers. The implementation will integrate seamlessly with the existing screenshot capture workflow, adding clipboard functionality without disrupting the current download behavior. - -## Architecture - -The feature will be implemented across three main components: - -1. **Popup UI Enhancement**: Add toggle control and persistence logic -2. **Content Script Integration**: Modify screenshot capture to include clipboard operations -3. **Storage Management**: Extend existing preference storage system - -The clipboard functionality will be implemented as an optional enhancement to the existing screenshot workflow, ensuring backward compatibility and graceful degradation. - -## Components and Interfaces - -### Popup Interface (`popup.html` & `popup.js`) - -**New UI Elements:** -- Toggle switch control for "Copy to Clipboard" option -- Positioned between background selector and start button -- Consistent styling with existing controls - -**Storage Integration:** -- Extend existing `chrome.storage.sync` usage to include `copyToClipboard` preference -- Default value: `true` (enabled by default for better user experience) -- Load and save preferences alongside existing background preference - -**Message Passing:** -- Include `copyToClipboard` setting in the `startSelector` message to content script -- No changes needed to existing message structure, just additional property - -### Content Script Enhancement (`content.js`) - -**ScreenshotSelector Class Modifications:** -- Add `copyToClipboard` property to constructor -- Modify `init()` method to accept and store clipboard preference -- Enhance `captureElement()` method to include clipboard operations - -**Clipboard Implementation:** -```javascript -async copyCanvasToClipboard(canvas) { - try { - // Convert canvas to blob - const blob = await new Promise(resolve => - canvas.toBlob(resolve, 'image/png') - ); - - // Use Clipboard API - await navigator.clipboard.write([ - new ClipboardItem({ 'image/png': blob }) - ]); - - return { success: true }; - } catch (error) { - return { success: false, error: error.message }; - } -} -``` - -**Error Handling:** -- Graceful fallback when Clipboard API is unavailable -- User-friendly error messages for clipboard failures -- Ensure screenshot download continues even if clipboard fails - -### User Feedback System - -**Success States:** -- "Screenshot saved and copied to clipboard!" - when both operations succeed -- "Screenshot saved! (Clipboard copy failed: [reason])" - when download succeeds but clipboard fails - -**Loading States:** -- Update existing loading message to indicate clipboard operation when enabled -- "Capturing screenshot and preparing clipboard..." vs "Capturing screenshot..." - -## Data Models - -### Settings Storage Schema -```javascript -{ - backgroundPreference: 'black' | 'transparent' | 'white', - copyToClipboard: boolean // New addition -} -``` - -### Message Interface Extension -```javascript -// startSelector message -{ - action: 'startSelector', - background: string, - copyToClipboard: boolean // New addition -} -``` - -## Error Handling - -### Clipboard API Availability -- Check for `navigator.clipboard` and `ClipboardItem` support -- Provide clear error messages when API is unavailable -- Continue with download-only functionality as fallback - -### Permission Handling -- Clipboard write operations may require user gesture -- Handle permission denied scenarios gracefully -- Provide user guidance for enabling clipboard permissions if needed - -### Browser Compatibility -- Primary support: Chrome/Edge 76+, Firefox 87+, Safari 13.1+ -- Fallback behavior for older browsers: disable clipboard feature with notification -- No impact on core screenshot functionality - -## Testing Strategy - -### Unit Testing Approach -- Mock Clipboard API for testing clipboard operations -- Test preference storage and retrieval -- Verify message passing between popup and content script -- Test error handling scenarios - -### Integration Testing -- Test complete workflow: toggle setting → capture screenshot → verify clipboard content -- Test with different background settings and clipboard combinations -- Verify graceful degradation when Clipboard API unavailable - -### Browser Compatibility Testing -- Test across Chrome, Firefox, Safari, Edge -- Verify behavior on older browser versions -- Test permission scenarios and user gesture requirements - -### User Experience Testing -- Verify toggle state persistence across browser sessions -- Test visual feedback for success/error states -- Confirm tooltip and help text clarity - -## Implementation Considerations - -### Performance Impact -- Clipboard operations are asynchronous and won't block screenshot download -- Canvas-to-blob conversion adds minimal overhead -- No impact on screenshot capture performance - -### Security Considerations -- Clipboard API requires secure context (HTTPS) -- User gesture requirement for clipboard write operations -- No sensitive data exposure through clipboard operations - -### Accessibility -- Toggle control will include proper ARIA labels -- Keyboard navigation support for toggle control -- Screen reader compatible success/error messages - -## Browser API Dependencies - -### Required APIs -- `navigator.clipboard.write()` - Modern clipboard API -- `ClipboardItem` constructor - For image data handling -- `canvas.toBlob()` - Convert canvas to blob format - -### Fallback Strategy -- Detect API availability before attempting clipboard operations -- Provide clear user feedback when clipboard features unavailable -- Maintain full functionality for screenshot download regardless of clipboard support \ No newline at end of file diff --git a/.kiro/specs/copy-to-clipboard-toggle/requirements.md b/.kiro/specs/copy-to-clipboard-toggle/requirements.md deleted file mode 100644 index 2553626..0000000 --- a/.kiro/specs/copy-to-clipboard-toggle/requirements.md +++ /dev/null @@ -1,51 +0,0 @@ -# Requirements Document - -## Introduction - -This feature adds a copy to clipboard toggle option to the Full Screenshot Selector extension, allowing users to choose whether captured screenshots should be automatically copied to the clipboard in addition to being downloaded as files. This provides users with more flexibility in how they handle their screenshots, enabling quick pasting into other applications without needing to locate and open the downloaded file. - -## Requirements - -### Requirement 1 - -**User Story:** As a user of the screenshot extension, I want to toggle whether screenshots are copied to clipboard, so that I can quickly paste them into other applications without downloading files. - -#### Acceptance Criteria - -1. WHEN the popup is opened THEN the system SHALL display a toggle control for "Copy to Clipboard" -2. WHEN the user toggles the copy to clipboard option THEN the system SHALL save this preference to browser storage -3. WHEN the extension is reopened THEN the system SHALL restore the previously saved copy to clipboard preference -4. WHEN a screenshot is captured AND copy to clipboard is enabled THEN the system SHALL copy the image data to the clipboard -5. WHEN a screenshot is captured AND copy to clipboard is enabled THEN the system SHALL still download the file as before (both actions occur) - -### Requirement 2 - -**User Story:** As a user, I want the copy to clipboard feature to work reliably across different browsers, so that I can depend on this functionality regardless of my browser choice. - -#### Acceptance Criteria - -1. WHEN copy to clipboard is enabled THEN the system SHALL use the Clipboard API if available -2. IF the Clipboard API is not available THEN the system SHALL provide appropriate fallback behavior -3. WHEN clipboard copying fails THEN the system SHALL display an error message to the user -4. WHEN clipboard copying succeeds THEN the system SHALL display a success confirmation - -### Requirement 3 - -**User Story:** As a user, I want clear visual feedback about the copy to clipboard feature, so that I understand when it's enabled and when clipboard operations succeed or fail. - -#### Acceptance Criteria - -1. WHEN the copy to clipboard toggle is enabled THEN the system SHALL display visual indication of the enabled state -2. WHEN a screenshot is captured with clipboard copying enabled THEN the system SHALL show a success message indicating both download and clipboard copy -3. WHEN clipboard copying fails THEN the system SHALL show an error message while still confirming the download succeeded -4. WHEN hovering over the copy to clipboard toggle THEN the system SHALL display helpful tooltip text - -### Requirement 4 - -**User Story:** As a user, I want the copy to clipboard feature to handle different image formats appropriately, so that the clipboard content works well with various applications. - -#### Acceptance Criteria - -1. WHEN copying to clipboard THEN the system SHALL copy the image in PNG format -2. WHEN copying to clipboard THEN the system SHALL preserve the same image quality as the downloaded file -3. WHEN copying to clipboard THEN the system SHALL handle transparency settings according to the background preference \ No newline at end of file diff --git a/.kiro/specs/copy-to-clipboard-toggle/tasks.md b/.kiro/specs/copy-to-clipboard-toggle/tasks.md deleted file mode 100644 index 25d7b74..0000000 --- a/.kiro/specs/copy-to-clipboard-toggle/tasks.md +++ /dev/null @@ -1,64 +0,0 @@ -# Implementation Plan - -- [x] 1. Add copy to clipboard toggle UI to popup - - Add HTML toggle control between background selector and start button in popup.html - - Style the toggle control to match existing UI design patterns - - Include proper ARIA labels and accessibility attributes for the toggle - - _Requirements: 1.1, 3.1, 3.4_ - -- [x] 2. Implement clipboard preference storage in popup - - Extend existing storage logic in popup.js to handle copyToClipboard preference - - Set default value to true for better user experience - - Load saved clipboard preference on popup initialization - - Save clipboard preference changes to chrome.storage.sync - - _Requirements: 1.2, 1.3_ - -- [x] 3. Update message passing to include clipboard setting - - Modify startSelector message in popup.js to include copyToClipboard property - - Update content script message handler to receive and store clipboard preference - - Ensure backward compatibility with existing message structure - - _Requirements: 1.1, 1.4_ - -- [x] 4. Implement clipboard API functionality in content script - - Add copyCanvasToClipboard method to ScreenshotSelector class - - Implement canvas to blob conversion for PNG format - - Use navigator.clipboard.write() with ClipboardItem for image data - - Handle async clipboard operations with proper error catching - - _Requirements: 2.1, 4.1, 4.2, 4.3_ - -- [x] 5. Add clipboard API availability detection - - Create method to check for navigator.clipboard and ClipboardItem support - - Implement graceful fallback when Clipboard API is unavailable - - Provide user feedback when clipboard features are not supported - - _Requirements: 2.2_ - -- [x] 6. Integrate clipboard operations into screenshot capture workflow - - Modify captureElement method to include clipboard operations when enabled - - Ensure clipboard copying happens after successful canvas generation - - Maintain existing download functionality regardless of clipboard success/failure - - _Requirements: 1.4, 1.5_ - -- [x] 7. Implement comprehensive error handling for clipboard operations - - Handle clipboard write permission errors gracefully - - Provide specific error messages for different failure scenarios - - Ensure screenshot download continues even when clipboard operations fail - - _Requirements: 2.3_ - -- [x] 8. Update user feedback messages for clipboard operations - - Modify loading message to indicate clipboard preparation when enabled - - Update success message to confirm both download and clipboard copy - - Create error messages that distinguish between download and clipboard failures - - _Requirements: 2.4, 3.2, 3.3_ - -- [x] 9. Add tooltip and help text for clipboard toggle - - Implement tooltip showing clipboard feature explanation - - Add help text explaining clipboard functionality and browser requirements - - Ensure tooltip is accessible and keyboard navigable - - _Requirements: 3.4_ - -- [x] 10. Test clipboard functionality across different scenarios - - Write test cases for clipboard API availability detection - - Test clipboard operations with different background settings (transparent, black, white) - - Verify error handling when clipboard API is unavailable or permissions denied - - Test preference persistence across browser sessions - - _Requirements: 2.1, 2.2, 2.3, 4.3_ \ No newline at end of file diff --git a/.kiro/specs/save-to-pc-toggle/design.md b/.kiro/specs/save-to-pc-toggle/design.md deleted file mode 100644 index b877881..0000000 --- a/.kiro/specs/save-to-pc-toggle/design.md +++ /dev/null @@ -1,187 +0,0 @@ -# Design Document - -## Overview - -The save to PC toggle feature will be implemented as an additional setting in the extension popup, positioned alongside the existing clipboard toggle. The feature will modify the existing screenshot capture workflow to conditionally perform file downloads based on user preference. The implementation will ensure that users can independently control both clipboard copying and file downloading, providing maximum flexibility in their screenshot workflow. - -## Architecture - -The feature will be implemented across three main components: - -1. **Popup UI Enhancement**: Add toggle control and persistence logic -2. **Content Script Integration**: Modify screenshot capture to conditionally download files -3. **Storage Management**: Extend existing preference storage system -4. **Validation Logic**: Ensure at least one output method is selected - -The save to PC functionality will be implemented as a conditional enhancement to the existing screenshot workflow, maintaining backward compatibility while providing new flexibility. - -## Components and Interfaces - -### Popup Interface (`popup.html` & `popup.js`) - -**New UI Elements:** -- Toggle switch control for "Save to PC" option -- Positioned above the clipboard toggle for logical grouping -- Consistent styling with existing controls -- Warning message when both toggles are disabled - -**Storage Integration:** -- Extend existing `chrome.storage.sync` usage to include `saveToPc` preference -- Default value: `true` (enabled by default to maintain existing behavior) -- Load and save preferences alongside existing background and clipboard preferences - -**Validation Logic:** -- Check that at least one output method (save to PC or clipboard) is enabled -- Display warning message when both are disabled -- Prevent screenshot capture when no output method is selected - -**Message Passing:** -- Include `saveToPc` setting in the `startSelector` message to content script -- No changes needed to existing message structure, just additional property - -### Content Script Enhancement (`content.js`) - -**ScreenshotSelector Class Modifications:** -- Add `saveToPc` property to constructor -- Modify `init()` method to accept and store save to PC preference -- Enhance `captureElement()` method to conditionally perform file downloads - -**Conditional Download Implementation:** -```javascript -// In captureElement method, replace automatic download with conditional logic -if (this.saveToPc) { - const link = document.createElement('a'); - link.href = canvas.toDataURL('image/png'); - link.download = `screenshot-${new Date().toISOString().slice(0, 19).replace(/[:.]/g, '-')}.png`; - link.click(); -} -``` - -**User Feedback Enhancement:** -- Update success messages to reflect which operations were performed -- Handle cases where no output method is selected (should not occur due to popup validation) - -### User Feedback System - -**Success States:** -- "Screenshot saved and copied to clipboard!" - when both operations succeed -- "Screenshot saved!" - when only save to PC is enabled and succeeds -- "Screenshot copied to clipboard!" - when only clipboard is enabled and succeeds -- "Screenshot captured!" - fallback message for edge cases - -**Error States:** -- "Please enable at least one output method (Save to PC or Copy to Clipboard)" - when both are disabled -- Existing clipboard error messages remain unchanged - -**Loading States:** -- Update loading message to reflect enabled operations -- "Capturing screenshot..." - when only save to PC is enabled -- "Capturing screenshot and preparing for clipboard..." - when only clipboard is enabled -- "Capturing screenshot and preparing for clipboard..." - when both are enabled (clipboard preparation is the longer operation) - -## Data Models - -### Settings Storage Schema -```javascript -{ - backgroundPreference: 'black' | 'transparent' | 'white', - copyToClipboard: boolean, - saveToPc: boolean // New addition -} -``` - -### Message Interface Extension -```javascript -// startSelector message -{ - action: 'startSelector', - background: string, - copyToClipboard: boolean, - saveToPc: boolean // New addition -} -``` - -## Error Handling - -### Validation Errors -- Prevent screenshot capture when both save to PC and clipboard are disabled -- Display clear error message in popup when no output method is selected -- Provide guidance on enabling at least one option - -### Download Failures -- Handle file download failures gracefully (though these are rare in modern browsers) -- Ensure clipboard operations continue even if download fails (when both are enabled) -- Provide specific error messages for download-related issues - -### Backward Compatibility -- Ensure existing users see no change in behavior (save to PC enabled by default) -- Handle cases where preference is not yet set in storage -- Maintain existing error handling for clipboard operations - -## Testing Strategy - -### Unit Testing Approach -- Test preference storage and retrieval for save to PC setting -- Verify message passing includes new saveToPc property -- Test validation logic for ensuring at least one output method is enabled -- Mock file download operations for testing conditional download logic - -### Integration Testing -- Test complete workflow: toggle setting → capture screenshot → verify file download behavior -- Test all four combinations of save to PC and clipboard settings -- Verify error handling when both options are disabled -- Test preference persistence across browser sessions - -### User Experience Testing -- Verify toggle state persistence across browser sessions -- Test visual feedback for different operation combinations -- Confirm tooltip and help text clarity -- Test warning messages when both toggles are disabled - -## Implementation Considerations - -### Performance Impact -- No performance impact when save to PC is enabled (existing behavior) -- Slight performance improvement when save to PC is disabled (no file creation) -- No impact on clipboard operations - -### Security Considerations -- File downloads use existing browser download mechanisms -- No new security concerns introduced -- Maintains existing security model for clipboard operations - -### Accessibility -- Save to PC toggle will include proper ARIA labels -- Keyboard navigation support for toggle control -- Screen reader compatible success/error messages -- Warning messages will be announced to screen readers - -### User Experience Design -- Logical grouping of output method toggles -- Clear visual hierarchy with save to PC above clipboard (primary → secondary) -- Consistent styling with existing UI elements -- Intuitive default settings (both enabled initially) - -## Browser Compatibility - -### File Download Support -- File downloads work in all modern browsers -- No fallback needed as this is core browser functionality -- Existing implementation already handles download edge cases - -### Storage and UI -- Uses existing chrome.storage.sync API (already implemented) -- Toggle UI uses existing CSS patterns -- No new browser API dependencies - -## Migration Strategy - -### Existing Users -- Default `saveToPc` to `true` when preference doesn't exist -- No change in behavior for existing users -- Seamless upgrade experience - -### New Users -- Both save to PC and clipboard enabled by default -- Provides full functionality out of the box -- Users can customize based on their workflow preferences \ No newline at end of file diff --git a/.kiro/specs/save-to-pc-toggle/requirements.md b/.kiro/specs/save-to-pc-toggle/requirements.md deleted file mode 100644 index 20b9a19..0000000 --- a/.kiro/specs/save-to-pc-toggle/requirements.md +++ /dev/null @@ -1,51 +0,0 @@ -# Requirements Document - -## Introduction - -This feature adds a save to PC toggle option to the Full Screenshot Selector extension, allowing users to choose whether captured screenshots should be automatically downloaded as files to their computer. This provides users with more flexibility in how they handle their screenshots, enabling them to use only the clipboard functionality without cluttering their downloads folder with files they may not need. - -## Requirements - -### Requirement 1 - -**User Story:** As a user of the screenshot extension, I want to toggle whether screenshots are saved to my PC, so that I can avoid downloading files when I only need to paste the image elsewhere. - -#### Acceptance Criteria - -1. WHEN the popup is opened THEN the system SHALL display a toggle control for "Save to PC" -2. WHEN the user toggles the save to PC option THEN the system SHALL save this preference to browser storage -3. WHEN the extension is reopened THEN the system SHALL restore the previously saved save to PC preference -4. WHEN a screenshot is captured AND save to PC is enabled THEN the system SHALL download the file as before -5. WHEN a screenshot is captured AND save to PC is disabled THEN the system SHALL NOT download any file - -### Requirement 2 - -**User Story:** As a user, I want clear visual feedback about the save to PC feature, so that I understand when files will be downloaded and when they won't. - -#### Acceptance Criteria - -1. WHEN the save to PC toggle is enabled THEN the system SHALL display visual indication of the enabled state -2. WHEN a screenshot is captured with save to PC enabled THEN the system SHALL show a success message indicating the download -3. WHEN a screenshot is captured with save to PC disabled THEN the system SHALL show a success message without mentioning download -4. WHEN hovering over the save to PC toggle THEN the system SHALL display helpful tooltip text - -### Requirement 3 - -**User Story:** As a user, I want the save to PC feature to work independently of the clipboard feature, so that I can choose any combination of saving and copying that suits my workflow. - -#### Acceptance Criteria - -1. WHEN both save to PC and copy to clipboard are enabled THEN the system SHALL perform both operations -2. WHEN only save to PC is enabled THEN the system SHALL only download the file -3. WHEN only copy to clipboard is enabled THEN the system SHALL only copy to clipboard -4. WHEN both features are disabled THEN the system SHALL show an error message and not capture the screenshot - -### Requirement 4 - -**User Story:** As a user, I want sensible default settings for the save to PC feature, so that the extension works intuitively without requiring configuration. - -#### Acceptance Criteria - -1. WHEN the extension is used for the first time THEN the save to PC option SHALL be enabled by default -2. WHEN upgrading from a previous version THEN the save to PC option SHALL be enabled by default to maintain existing behavior -3. WHEN both save to PC and clipboard options are available THEN users SHALL be able to configure them independently \ No newline at end of file diff --git a/.kiro/specs/save-to-pc-toggle/tasks.md b/.kiro/specs/save-to-pc-toggle/tasks.md deleted file mode 100644 index f5d16d3..0000000 --- a/.kiro/specs/save-to-pc-toggle/tasks.md +++ /dev/null @@ -1,71 +0,0 @@ -# Implementation Plan - -- [x] 1. Add save to PC toggle UI to popup - - Add HTML toggle control above the clipboard toggle in popup.html - - Style the toggle control to match existing UI design patterns - - Include proper ARIA labels and accessibility attributes for the toggle - - Position the save to PC toggle logically above clipboard toggle - - _Requirements: 1.1, 2.1, 2.4_ - -- [x] 2. Implement save to PC preference storage in popup - - Extend existing storage logic in popup.js to handle saveToPc preference - - Set default value to true to maintain existing behavior for current users - - Load saved save to PC preference on popup initialization - - Save save to PC preference changes to chrome.storage.sync - - _Requirements: 1.2, 1.3, 4.1, 4.2_ - -- [x] 3. Add validation logic for output method selection - - Create validation function to ensure at least one output method is enabled - - Display warning message in popup when both save to PC and clipboard are disabled - - Prevent screenshot capture when no output method is selected - - Update start button state based on validation results - - _Requirements: 3.4_ - -- [x] 4. Update message passing to include save to PC setting - - Modify startSelector message in popup.js to include saveToPc property - - Update content script message handler to receive and store save to PC preference - - Ensure backward compatibility with existing message structure - - _Requirements: 1.1, 1.4_ - -- [x] 5. Implement conditional file download in content script - - Modify captureElement method in ScreenshotSelector class to conditionally download files - - Wrap existing download logic in conditional check for saveToPc preference - - Ensure canvas generation still occurs regardless of download preference (needed for clipboard) - - Maintain existing download filename generation and format - - _Requirements: 1.4, 1.5, 3.1, 3.2_ - -- [x] 6. Update user feedback messages for different operation combinations - - Modify success messages to reflect which operations were performed - - Create specific messages for save-only, clipboard-only, and both operations - - Update loading messages to reflect enabled operations - - Ensure error messages are appropriate for each operation combination - - _Requirements: 2.2, 2.3, 3.1, 3.2, 3.3_ - -- [x] 7. Add tooltip and help text for save to PC toggle - - Implement tooltip showing save to PC feature explanation - - Add help text explaining the relationship between save to PC and clipboard features - - Ensure tooltip is accessible and keyboard navigable - - Include information about default behavior and workflow flexibility - - _Requirements: 2.4_ - -- [x] 8. Implement warning system for disabled output methods - - Create visual warning when both save to PC and clipboard toggles are disabled - - Display clear guidance on enabling at least one output method - - Make warning accessible to screen readers - - Update warning state dynamically as toggles change - - _Requirements: 3.4_ - -- [x] 9. Test all combinations of save to PC and clipboard settings - - Write test cases for save-only mode (saveToPc: true, clipboard: false) - - Write test cases for clipboard-only mode (saveToPc: false, clipboard: true) - - Write test cases for both enabled (saveToPc: true, clipboard: true) - - Write test cases for validation when both disabled (saveToPc: false, clipboard: false) - - Verify preference persistence across browser sessions for all combinations - - _Requirements: 3.1, 3.2, 3.3, 3.4, 4.3_ - -- [ ] 10. Test backward compatibility and migration - - Test behavior when saveToPc preference doesn't exist in storage (new installation) - - Test behavior when upgrading from version without saveToPc preference - - Verify that existing users maintain current behavior (files still download by default) - - Test that new users get both features enabled by default - - _Requirements: 4.1, 4.2_ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 5480842..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "kiroAgent.configureMCP": "Disabled" -} \ No newline at end of file diff --git a/coverage/base.css b/coverage/base.css deleted file mode 100644 index f418035..0000000 --- a/coverage/base.css +++ /dev/null @@ -1,224 +0,0 @@ -body, html { - margin:0; padding: 0; - height: 100%; -} -body { - font-family: Helvetica Neue, Helvetica, Arial; - font-size: 14px; - color:#333; -} -.small { font-size: 12px; } -*, *:after, *:before { - -webkit-box-sizing:border-box; - -moz-box-sizing:border-box; - box-sizing:border-box; - } -h1 { font-size: 20px; margin: 0;} -h2 { font-size: 14px; } -pre { - font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; - margin: 0; - padding: 0; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; -} -a { color:#0074D9; text-decoration:none; } -a:hover { text-decoration:underline; } -.strong { font-weight: bold; } -.space-top1 { padding: 10px 0 0 0; } -.pad2y { padding: 20px 0; } -.pad1y { padding: 10px 0; } -.pad2x { padding: 0 20px; } -.pad2 { padding: 20px; } -.pad1 { padding: 10px; } -.space-left2 { padding-left:55px; } -.space-right2 { padding-right:20px; } -.center { text-align:center; } -.clearfix { display:block; } -.clearfix:after { - content:''; - display:block; - height:0; - clear:both; - visibility:hidden; - } -.fl { float: left; } -@media only screen and (max-width:640px) { - .col3 { width:100%; max-width:100%; } - .hide-mobile { display:none!important; } -} - -.quiet { - color: #7f7f7f; - color: rgba(0,0,0,0.5); -} -.quiet a { opacity: 0.7; } - -.fraction { - font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; - font-size: 10px; - color: #555; - background: #E8E8E8; - padding: 4px 5px; - border-radius: 3px; - vertical-align: middle; -} - -div.path a:link, div.path a:visited { color: #333; } -table.coverage { - border-collapse: collapse; - margin: 10px 0 0 0; - padding: 0; -} - -table.coverage td { - margin: 0; - padding: 0; - vertical-align: top; -} -table.coverage td.line-count { - text-align: right; - padding: 0 5px 0 20px; -} -table.coverage td.line-coverage { - text-align: right; - padding-right: 10px; - min-width:20px; -} - -table.coverage td span.cline-any { - display: inline-block; - padding: 0 5px; - width: 100%; -} -.missing-if-branch { - display: inline-block; - margin-right: 5px; - border-radius: 3px; - position: relative; - padding: 0 4px; - background: #333; - color: yellow; -} - -.skip-if-branch { - display: none; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: #ccc; - color: white; -} -.missing-if-branch .typ, .skip-if-branch .typ { - color: inherit !important; -} -.coverage-summary { - border-collapse: collapse; - width: 100%; -} -.coverage-summary tr { border-bottom: 1px solid #bbb; } -.keyline-all { border: 1px solid #ddd; } -.coverage-summary td, .coverage-summary th { padding: 10px; } -.coverage-summary tbody { border: 1px solid #bbb; } -.coverage-summary td { border-right: 1px solid #bbb; } -.coverage-summary td:last-child { border-right: none; } -.coverage-summary th { - text-align: left; - font-weight: normal; - white-space: nowrap; -} -.coverage-summary th.file { border-right: none !important; } -.coverage-summary th.pct { } -.coverage-summary th.pic, -.coverage-summary th.abs, -.coverage-summary td.pct, -.coverage-summary td.abs { text-align: right; } -.coverage-summary td.file { white-space: nowrap; } -.coverage-summary td.pic { min-width: 120px !important; } -.coverage-summary tfoot td { } - -.coverage-summary .sorter { - height: 10px; - width: 7px; - display: inline-block; - margin-left: 0.5em; - background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; -} -.coverage-summary .sorted .sorter { - background-position: 0 -20px; -} -.coverage-summary .sorted-desc .sorter { - background-position: 0 -10px; -} -.status-line { height: 10px; } -/* yellow */ -.cbranch-no { background: yellow !important; color: #111; } -/* dark red */ -.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } -.low .chart { border:1px solid #C21F39 } -.highlighted, -.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ - background: #C21F39 !important; -} -/* medium red */ -.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } -/* light red */ -.low, .cline-no { background:#FCE1E5 } -/* light green */ -.high, .cline-yes { background:rgb(230,245,208) } -/* medium green */ -.cstat-yes { background:rgb(161,215,106) } -/* dark green */ -.status-line.high, .high .cover-fill { background:rgb(77,146,33) } -.high .chart { border:1px solid rgb(77,146,33) } -/* dark yellow (gold) */ -.status-line.medium, .medium .cover-fill { background: #f9cd0b; } -.medium .chart { border:1px solid #f9cd0b; } -/* light yellow */ -.medium { background: #fff4c2; } - -.cstat-skip { background: #ddd; color: #111; } -.fstat-skip { background: #ddd; color: #111 !important; } -.cbranch-skip { background: #ddd !important; color: #111; } - -span.cline-neutral { background: #eaeaea; } - -.coverage-summary td.empty { - opacity: .5; - padding-top: 4px; - padding-bottom: 4px; - line-height: 1; - color: #888; -} - -.cover-fill, .cover-empty { - display:inline-block; - height: 12px; -} -.chart { - line-height: 0; -} -.cover-empty { - background: white; -} -.cover-full { - border-right: none !important; -} -pre.prettyprint { - border: none !important; - padding: 0 !important; - margin: 0 !important; -} -.com { color: #999 !important; } -.ignore-none { color: #999; font-weight: normal; } - -.wrapper { - min-height: 100%; - height: auto !important; - height: 100%; - margin: 0 auto -48px; -} -.footer, .push { - height: 48px; -} diff --git a/coverage/block-navigation.js b/coverage/block-navigation.js deleted file mode 100644 index cc12130..0000000 --- a/coverage/block-navigation.js +++ /dev/null @@ -1,87 +0,0 @@ -/* eslint-disable */ -var jumpToCode = (function init() { - // Classes of code we would like to highlight in the file view - var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; - - // Elements to highlight in the file listing view - var fileListingElements = ['td.pct.low']; - - // We don't want to select elements that are direct descendants of another match - var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` - - // Selecter that finds elements on the page to which we can jump - var selector = - fileListingElements.join(', ') + - ', ' + - notSelector + - missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` - - // The NodeList of matching elements - var missingCoverageElements = document.querySelectorAll(selector); - - var currentIndex; - - function toggleClass(index) { - missingCoverageElements - .item(currentIndex) - .classList.remove('highlighted'); - missingCoverageElements.item(index).classList.add('highlighted'); - } - - function makeCurrent(index) { - toggleClass(index); - currentIndex = index; - missingCoverageElements.item(index).scrollIntoView({ - behavior: 'smooth', - block: 'center', - inline: 'center' - }); - } - - function goToPrevious() { - var nextIndex = 0; - if (typeof currentIndex !== 'number' || currentIndex === 0) { - nextIndex = missingCoverageElements.length - 1; - } else if (missingCoverageElements.length > 1) { - nextIndex = currentIndex - 1; - } - - makeCurrent(nextIndex); - } - - function goToNext() { - var nextIndex = 0; - - if ( - typeof currentIndex === 'number' && - currentIndex < missingCoverageElements.length - 1 - ) { - nextIndex = currentIndex + 1; - } - - makeCurrent(nextIndex); - } - - return function jump(event) { - if ( - document.getElementById('fileSearch') === document.activeElement && - document.activeElement != null - ) { - // if we're currently focused on the search input, we don't want to navigate - return; - } - - switch (event.which) { - case 78: // n - case 74: // j - goToNext(); - break; - case 66: // b - case 75: // k - case 80: // p - goToPrevious(); - break; - } - }; -})(); -window.addEventListener('keydown', jumpToCode); diff --git a/coverage/content.js.html b/coverage/content.js.html deleted file mode 100644 index 8519402..0000000 --- a/coverage/content.js.html +++ /dev/null @@ -1,2893 +0,0 @@ - - - - - - Code coverage report for content.js - - - - - - - - - -
-
-

All files content.js

-
- -
- 0% - Statements - 0/371 -
- - -
- 0% - Branches - 0/214 -
- - -
- 0% - Functions - 0/44 -
- - -
- 0% - Lines - 0/356 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466 -467 -468 -469 -470 -471 -472 -473 -474 -475 -476 -477 -478 -479 -480 -481 -482 -483 -484 -485 -486 -487 -488 -489 -490 -491 -492 -493 -494 -495 -496 -497 -498 -499 -500 -501 -502 -503 -504 -505 -506 -507 -508 -509 -510 -511 -512 -513 -514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526 -527 -528 -529 -530 -531 -532 -533 -534 -535 -536 -537 -538 -539 -540 -541 -542 -543 -544 -545 -546 -547 -548 -549 -550 -551 -552 -553 -554 -555 -556 -557 -558 -559 -560 -561 -562 -563 -564 -565 -566 -567 -568 -569 -570 -571 -572 -573 -574 -575 -576 -577 -578 -579 -580 -581 -582 -583 -584 -585 -586 -587 -588 -589 -590 -591 -592 -593 -594 -595 -596 -597 -598 -599 -600 -601 -602 -603 -604 -605 -606 -607 -608 -609 -610 -611 -612 -613 -614 -615 -616 -617 -618 -619 -620 -621 -622 -623 -624 -625 -626 -627 -628 -629 -630 -631 -632 -633 -634 -635 -636 -637 -638 -639 -640 -641 -642 -643 -644 -645 -646 -647 -648 -649 -650 -651 -652 -653 -654 -655 -656 -657 -658 -659 -660 -661 -662 -663 -664 -665 -666 -667 -668 -669 -670 -671 -672 -673 -674 -675 -676 -677 -678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -695 -696 -697 -698 -699 -700 -701 -702 -703 -704 -705 -706 -707 -708 -709 -710 -711 -712 -713 -714 -715 -716 -717 -718 -719 -720 -721 -722 -723 -724 -725 -726 -727 -728 -729 -730 -731 -732 -733 -734 -735 -736 -737 -738 -739 -740 -741 -742 -743 -744 -745 -746 -747 -748 -749 -750 -751 -752 -753 -754 -755 -756 -757 -758 -759 -760 -761 -762 -763 -764 -765 -766 -767 -768 -769 -770 -771 -772 -773 -774 -775 -776 -777 -778 -779 -780 -781 -782 -783 -784 -785 -786 -787 -788 -789 -790 -791 -792 -793 -794 -795 -796 -797 -798 -799 -800 -801 -802 -803 -804 -805 -806 -807 -808 -809 -810 -811 -812 -813 -814 -815 -816 -817 -818 -819 -820 -821 -822 -823 -824 -825 -826 -827 -828 -829 -830 -831 -832 -833 -834 -835 -836 -837 -838 -839 -840 -841 -842 -843 -844 -845 -846 -847 -848 -849 -850 -851 -852 -853 -854 -855 -856 -857 -858 -859 -860 -861 -862 -863 -864 -865 -866 -867 -868 -869 -870 -871 -872 -873 -874 -875 -876 -877 -878 -879 -880 -881 -882 -883 -884 -885 -886 -887 -888 -889 -890 -891 -892 -893 -894 -895 -896 -897 -898 -899 -900 -901 -902 -903 -904 -905 -906 -907 -908 -909 -910 -911 -912 -913 -914 -915 -916 -917 -918 -919 -920 -921 -922 -923 -924 -925 -926 -927 -928 -929 -930 -931 -932 -933 -934 -935 -936 -937  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 
// Content script for Full Screenshot Selector Chrome Extension
-class ScreenshotSelector {
-  constructor() {
-    this.isActive = false;
-    this.currentHighlight = null;
-    this.overlay = null;
-    this.style = null;
-    this.background = 'black';
-    this.copyToClipboard = true; // Default to true
-  }
- 
-  async init(background = 'black', copyToClipboard = true) {
-    if (this.isActive) {
-      console.log('Screenshot selector already active');
-      return;
-    }
- 
-    this.background = background;
-    this.copyToClipboard = copyToClipboard;
-    this.isActive = true;
- 
-    this.createUI();
-    this.addEventListeners();
-  }
- 
-  createUI() {
-    // Create overlay UI
-    this.overlay = document.createElement('div');
-    this.overlay.id = 'screenshot-selector-overlay';
-    this.overlay.innerHTML = `
-      <div style="position: fixed; top: 20px; left: 20px; background: rgba(0,0,0,0.9); color: white; padding: 12px 16px; border-radius: 8px; z-index: 2147483647; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); backdrop-filter: blur(10px);">
-        <div style="display: flex; align-items: center; gap: 10px;">
-          <span>📸</span>
-          <span>Hover over elements and click to capture</span>
-          <button id="screenshot-cancel" style="margin-left: 10px; padding: 4px 8px; background: #ff4757; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 12px;">ESC</button>
-        </div>
-      </div>
-    `;
- 
-    // Add hover highlighting styles
-    this.style = document.createElement('style');
-    this.style.textContent = `
-      .screenshot-highlight {
-        outline: 3px solid #00d2ff !important;
-        outline-offset: 2px !important;
-        cursor: crosshair !important;
-        position: relative !important;
-      }
-      .screenshot-highlight::after {
-        content: '';
-        position: absolute;
-        top: -5px;
-        left: -5px;
-        right: -5px;
-        bottom: -5px;
-        background: rgba(0, 210, 255, 0.1) !important;
-        pointer-events: none !important;
-        z-index: 2147483646 !important;
-      }
-      .screenshot-scrollable-indicator {
-        position: absolute !important;
-        border: 2px dotted #ff6b6b !important;
-        background: rgba(255, 107, 107, 0.05) !important;
-        pointer-events: none !important;
-        z-index: 2147483645 !important;
-      }
-      #screenshot-selector-overlay * {
-        cursor: default !important;
-      }
-    `;
- 
-    document.head.appendChild(this.style);
-    document.body.appendChild(this.overlay);
- 
-    // Cancel button functionality
-    document.getElementById('screenshot-cancel').onclick = () => this.cleanup();
-  }
- 
-  addEventListeners() {
-    this.handleMouseOver = this.handleMouseOver.bind(this);
-    this.handleClick = this.handleClick.bind(this);
-    this.handleKeyPress = this.handleKeyPress.bind(this);
- 
-    document.addEventListener('mouseover', this.handleMouseOver);
-    document.addEventListener('click', this.handleClick, true);
-    document.addEventListener('keydown', this.handleKeyPress);
-  }
- 
-  handleMouseOver(e) {
-    if (e.target.closest('#screenshot-selector-overlay')) return;
- 
-    // Clean up previous highlights and indicators
-    if (this.currentHighlight) {
-      this.currentHighlight.classList.remove('screenshot-highlight');
-      this.removeScrollableIndicators();
-    }
- 
-    this.currentHighlight = e.target;
-    e.target.classList.add('screenshot-highlight');
- 
-    // Add scrollable content indicators
-    this.addScrollableIndicators(e.target);
-  }
- 
-  handleClick(e) {
-    if (e.target.closest('#screenshot-selector-overlay')) return;
-    e.preventDefault();
-    e.stopPropagation();
- 
-    const element = e.target;
-    this.captureElement(element);
-  }
- 
-  handleKeyPress(e) {
-    if (e.key === 'Escape') {
-      this.cleanup();
-    }
-  }
- 
-  addScrollableIndicators(element) {
-    const rect = element.getBoundingClientRect();
-    const hasVerticalScroll = element.scrollHeight > element.clientHeight;
-    const hasHorizontalScroll = element.scrollWidth > element.clientWidth;
- 
-    if (!hasVerticalScroll && !hasHorizontalScroll) return;
- 
-    // Calculate the full content dimensions
-    const fullHeight = element.scrollHeight;
-    const fullWidth = element.scrollWidth;
-    const visibleHeight = element.clientHeight;
-    const visibleWidth = element.clientWidth;
- 
-    // Create indicator for full scrollable area
-    if (hasVerticalScroll || hasHorizontalScroll) {
-      const indicator = document.createElement('div');
-      indicator.className = 'screenshot-scrollable-indicator';
-      indicator.setAttribute('data-screenshot-indicator', 'true');
- 
-      // Position it relative to the viewport
-      const style = {
-        left: `${rect.left}px`,
-        top: `${rect.top}px`,
-        width: hasHorizontalScroll ? `${fullWidth}px` : `${rect.width}px`,
-        height: hasVerticalScroll ? `${fullHeight}px` : `${rect.height}px`,
-      };
- 
-      Object.assign(indicator.style, style);
-      document.body.appendChild(indicator);
- 
-      // Add a label to show the full dimensions
-      const label = document.createElement('div');
-      label.setAttribute('data-screenshot-indicator', 'true');
-      label.style.cssText = `
-        position: fixed;
-        top: ${rect.top - 25}px;
-        left: ${rect.left}px;
-        background: rgba(255, 107, 107, 0.9);
-        color: white;
-        padding: 2px 6px;
-        border-radius: 3px;
-        font-size: 11px;
-        font-family: monospace;
-        z-index: 2147483647;
-        pointer-events: none;
-      `;
- 
-      const scrollInfo = [];
-      if (hasVerticalScroll) scrollInfo.push(`H: ${fullHeight}px (visible: ${visibleHeight}px)`);
-      if (hasHorizontalScroll) scrollInfo.push(`W: ${fullWidth}px (visible: ${visibleWidth}px)`);
-      label.textContent = `Full content - ${scrollInfo.join(', ')}`;
- 
-      document.body.appendChild(label);
-    }
-  }
- 
-  removeScrollableIndicators() {
-    const indicators = document.querySelectorAll('[data-screenshot-indicator]');
-    indicators.forEach(indicator => indicator.remove());
-  }
- 
-  // Helper method to generate a unique selector for an element
-  getElementSelector(element) {
-    // Escape helper for CSS identifiers (handles Tailwind classes like lg:pr-0)
-    const escapeIdent = (ident) => {
-      try {
-        if (window.CSS && typeof window.CSS.escape === 'function') {
-          return window.CSS.escape(ident);
-        }
-      } catch (_) {}
-      // Fallback: escape most punctuation characters
-      return String(ident).replace(/([ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '\\$1');
-    };
- 
-    if (element.id) {
-      return `#${escapeIdent(element.id)}`;
-    }
- 
-    if (element.classList && element.classList.length) {
-      const classSelector = Array.from(element.classList)
-        .filter(Boolean)
-        .map(cls => `.${escapeIdent(cls)}`)
-        .join('');
-      if (classSelector) {
-        return `${element.tagName.toLowerCase()}${classSelector}`;
-      }
-    }
- 
-    // Fallback to tag name and position
-    const siblings = Array.from(element.parentNode?.children || []);
-    const index = siblings.indexOf(element);
-    return `${element.tagName.toLowerCase()}:nth-child(${index + 1})`;
-  }
- 
-    // Preserve computed styles for better rendering
-  preserveComputedStyles(clonedElement, originalElement) {
-    if (!originalElement || !clonedElement) return;
- 
-    const computedStyle = window.getComputedStyle(originalElement);
- 
-    // Comprehensive style properties including layout and icon-related ones
-    const importantStyles = [
-      // Typography and fonts
-      'font-family', 'font-size', 'font-weight', 'font-style', 'font-variant',
-      'text-align', 'text-decoration', 'text-transform', 'text-indent',
-      'line-height', 'letter-spacing', 'word-spacing', 'white-space',
- 
-      // Colors and backgrounds
-      'color', 'background-color', 'background-image', 'background-size',
-      'background-position', 'background-repeat', 'background-attachment',
- 
-      // Layout and positioning
-      'display', 'position', 'top', 'left', 'right', 'bottom',
-      'width', 'height', 'min-width', 'min-height', 'max-width', 'max-height',
-      'margin', 'padding', 'border', 'border-radius',
-      'float', 'clear', 'vertical-align',
- 
-      // Flexbox and Grid
-      'flex', 'flex-direction', 'flex-wrap', 'flex-basis', 'flex-grow', 'flex-shrink',
-      'justify-content', 'align-items', 'align-self', 'align-content',
-      'grid', 'grid-template', 'grid-area', 'grid-column', 'grid-row',
- 
-      // Visual effects
-      'opacity', 'visibility', 'overflow', 'overflow-x', 'overflow-y',
-      'box-shadow', 'text-shadow', 'transform', 'filter',
-      'z-index', 'cursor'
-    ];
- 
-    // Apply computed styles
-    importantStyles.forEach(property => {
-      const value = computedStyle.getPropertyValue(property);
-      if (value && value !== 'none' && value !== 'normal' && value !== 'auto' && value !== 'initial') {
-        try {
-          clonedElement.style.setProperty(property, value, 'important');
-        } catch (e) {
-          // Skip properties that can't be set
-        }
-      }
-    });
- 
-    // Handle pseudo-elements (::before and ::after) which often contain icons
-    this.preservePseudoElements(clonedElement, originalElement);
- 
-    // Recursively apply to children
-    const originalChildren = Array.from(originalElement.children);
-    const clonedChildren = Array.from(clonedElement.children);
- 
-    for (let i = 0; i < Math.min(originalChildren.length, clonedChildren.length); i++) {
-      this.preserveComputedStyles(clonedChildren[i], originalChildren[i]);
-    }
-  }
- 
-     // Handle pseudo-elements that often contain icons
-   preservePseudoElements(clonedElement, originalElement) {
-     try {
-       ['::before', '::after'].forEach(pseudo => {
-         const pseudoStyle = window.getComputedStyle(originalElement, pseudo);
-         const content = pseudoStyle.getPropertyValue('content');
- 
-         // If pseudo-element has content, try to preserve it
-         if (content && content !== 'none' && content !== '""') {
-           const pseudoProperties = [
-             'content', 'display', 'position', 'top', 'left', 'right', 'bottom',
-             'width', 'height', 'font-family', 'font-size', 'color',
-             'background-color', 'background-image', 'border', 'border-radius',
-             'transform', 'opacity'
-           ];
- 
-           // Create inline style for pseudo-element
-           let selector = this.getElementSelector(clonedElement);
-           let pseudoCSS = `${selector}${pseudo} {`;
-           pseudoProperties.forEach(prop => {
-             const value = pseudoStyle.getPropertyValue(prop);
-             if (value && value !== 'none' && value !== 'normal') {
-               pseudoCSS += `${prop}: ${value} !important;`;
-             }
-           });
-           pseudoCSS += '}';
- 
-           // Add to document head
-           const style = document.createElement('style');
-           style.textContent = pseudoCSS;
-           document.head.appendChild(style);
-         }
-       });
-     } catch (e) {
-       // Pseudo-element handling failed, continue without it
-     }
-   }
- 
-   // Wait for fonts and resources to load properly
-   async waitForFontsAndResources(element) {
-     // Wait for document fonts to load
-     if (document.fonts && document.fonts.ready) {
-       try {
-         await document.fonts.ready;
-       } catch (e) {
-         // Font loading API not available or failed
-       }
-     }
- 
-     // Check for icon fonts (Font Awesome, Material Icons, etc.)
-     const iconFontFamilies = [
-       'FontAwesome', 'Font Awesome', 'Font Awesome 5', 'Font Awesome 6',
-       'Material Icons', 'Material Icons Outlined', 'Material Icons Sharp',
-       'Ionicons', 'Feather', 'Lucide', 'Tabler Icons'
-     ];
- 
-     // Force load any icon fonts found in the element
-     const allElements = [element, ...element.querySelectorAll('*')];
-     const fontPromises = [];
- 
-     allElements.forEach(el => {
-       const computedStyle = window.getComputedStyle(el);
-       const fontFamily = computedStyle.fontFamily;
- 
-       iconFontFamilies.forEach(iconFont => {
-         if (fontFamily.includes(iconFont)) {
-           // Create a test element to ensure font is loaded
-           const testEl = document.createElement('span');
-           testEl.style.fontFamily = iconFont;
-           testEl.style.position = 'absolute';
-           testEl.style.left = '-9999px';
-           testEl.textContent = '■'; // Use a test character
-           document.body.appendChild(testEl);
- 
-           const fontPromise = new Promise(resolve => {
-             setTimeout(() => {
-               document.body.removeChild(testEl);
-               resolve();
-             }, 100);
-           });
-           fontPromises.push(fontPromise);
-         }
-       });
-     });
- 
-     // Wait for all font loading attempts
-     await Promise.all(fontPromises);
- 
-         // Additional wait for any remaining resources
-    await new Promise(resolve => setTimeout(resolve, 500));
-  }
- 
- 
- 
-  async captureElement(element) {
-    try {
-      // Determine loading message based on clipboard settings
-      let loadingMessage = 'Capturing screenshot...';
-      if (this.copyToClipboard) {
-        const availability = this.checkClipboardAPIAvailability();
-        if (availability.available) {
-          loadingMessage = 'Capturing screenshot and preparing for clipboard...';
-        } else {
-          loadingMessage = 'Capturing screenshot... (Clipboard not available)';
-        }
-      }
- 
-      // Show loading state
-      this.overlay.innerHTML = `
-        <div style="position: fixed; top: 20px; left: 20px; background: rgba(0,0,0,0.9); color: white; padding: 12px 16px; border-radius: 8px; z-index: 2147483647; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);">
-          <div style="display: flex; align-items: center; gap: 10px;">
-            <div style="width: 16px; height: 16px; border: 2px solid #fff; border-top: 2px solid transparent; border-radius: 50%; animation: spin 1s linear infinite;"></div>
-            <span>${loadingMessage}</span>
-          </div>
-        </div>
-        <style>
-          @keyframes spin {
-            0% { transform: rotate(0deg); }
-            100% { transform: rotate(360deg); }
-          }
-        </style>
-      `;
- 
-      // Remove highlight for clean capture first
-      element.classList.remove('screenshot-highlight');
-      this.removeScrollableIndicators();
- 
-      // Store original styles
-      const originalStyles = {
-        overflow: element.style.overflow,
-        overflowY: element.style.overflowY,
-        overflowX: element.style.overflowX,
-        height: element.style.height,
-        maxHeight: element.style.maxHeight,
-        position: element.style.position,
-        zIndex: element.style.zIndex,
-      };
- 
-      // Temporarily modify element for full capture
-      element.style.overflow = 'visible';
-      element.style.overflowY = 'visible';
-      element.style.overflowX = 'visible';
-      element.style.height = `${element.scrollHeight}px`;
-      element.style.maxHeight = 'none';
- 
-      // Wait for fonts and external resources to load
-      await this.waitForFontsAndResources(element);
- 
-            // Enhanced html2canvas configuration
-      const canvas = await html2canvas(element, {
-        useCORS: true,
-        allowTaint: false,
-        backgroundColor: this.background === 'transparent' ? null :
-                        this.background === 'white' ? '#ffffff' : '#000000',
- 
-        // Improved rendering options
-        scale: window.devicePixelRatio || 1, // Use device pixel ratio for crisp images
-        logging: false, // Disable logging for cleaner console
- 
-        // Better handling of external resources
-        imageTimeout: 15000, // Wait longer for images to load
- 
-        // Font handling and style preservation
-        onclone: (clonedDoc, clonedElementParam) => {
-          // Ensure all stylesheets are loaded in cloned document
-          const originalStyleSheets = Array.from(document.styleSheets);
-          const clonedHead = clonedDoc.head;
- 
-          // Copy all stylesheets to cloned document
-          originalStyleSheets.forEach(styleSheet => {
-            try {
-              if (styleSheet.href) {
-                // External stylesheet
-                const link = clonedDoc.createElement('link');
-                link.rel = 'stylesheet';
-                link.href = styleSheet.href;
-                link.type = 'text/css';
-                clonedHead.appendChild(link);
-              } else if (styleSheet.ownerNode && styleSheet.ownerNode.tagName === 'STYLE') {
-                // Inline stylesheet
-                const style = clonedDoc.createElement('style');
-                style.type = 'text/css';
-                try {
-                  const cssText = Array.from(styleSheet.cssRules).map(rule => rule.cssText).join('\n');
-                  style.textContent = cssText;
-                } catch (e) {
-                  // Fallback to original text content
-                  style.textContent = styleSheet.ownerNode.textContent;
-                }
-                clonedHead.appendChild(style);
-              }
-            } catch (e) {
-              // Skip stylesheets that can't be accessed (CORS issues)
-              console.log('Skipped stylesheet due to CORS:', e);
-            }
-          });
- 
-          // Apply computed styles to preserve appearance
-          const clonedElement = clonedElementParam;
-          const originalElement = element; // from outer scope
-          if (clonedElement && originalElement) {
-            this.preserveComputedStyles(clonedElement, originalElement);
-          }
- 
-          return clonedDoc;
-        }
-      });
- 
-      // Restore original styles
-      Object.assign(element.style, originalStyles);
- 
-      // Always download the image first (core functionality)
-      const link = document.createElement('a');
-      link.href = canvas.toDataURL('image/png');
-      link.download = `screenshot-${new Date().toISOString().slice(0, 19).replace(/[:.]/g, '-')}.png`;
-      link.click();
- 
-      // Handle clipboard operations if enabled (after successful canvas generation and download)
-      let clipboardResult = null;
-      if (this.copyToClipboard) {
-        const availability = this.checkClipboardAPIAvailability();
-        if (availability.available) {
-          try {
-            // Attempt clipboard operation with comprehensive error handling
-            clipboardResult = await this.copyCanvasToClipboard(canvas);
-          } catch (error) {
-            // Ensure clipboard errors don't break the workflow - this is a safety net
-            // The copyCanvasToClipboard method should handle all errors internally
-            console.error('Unexpected clipboard error caught in captureElement:', error);
-            clipboardResult = { 
-              success: false, 
-              error: 'Unexpected clipboard error occurred',
-              errorType: 'unexpected'
-            };
-          }
-        } else {
-          clipboardResult = { 
-            success: false, 
-            error: availability.reason,
-            errorType: 'api_unavailable'
-          };
-        }
-      }
- 
-      // Generate user feedback message based on clipboard results
-      let successMessage = 'Screenshot downloaded successfully!';
-      let messageColor = 'rgba(39, 174, 96, 0.95)'; // Green for success
-      
-      if (this.copyToClipboard) {
-        if (clipboardResult && clipboardResult.success) {
-          successMessage = 'Screenshot downloaded and copied to clipboard!';
-          // Keep green color for full success
-        } else {
-          // Download succeeded but clipboard failed - provide specific error feedback
-          const errorMessage = this.getClipboardErrorMessage(clipboardResult);
-          successMessage = `Screenshot downloaded successfully! ${errorMessage}`;
-          messageColor = 'rgba(243, 156, 18, 0.95)'; // Orange for partial success
-        }
-      }
- 
-      this.overlay.innerHTML = `
-        <div style="position: fixed; top: 20px; left: 20px; background: ${messageColor}; color: white; padding: 12px 16px; border-radius: 8px; z-index: 2147483647; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);">
-          <div style="display: flex; align-items: center; gap: 10px;">
-            <span>✅</span>
-            <span>${successMessage}</span>
-          </div>
-        </div>
-      `;
- 
-      // Notify popup
-      chrome.runtime.sendMessage({ action: 'selectorStopped', reason: 'screenshot-taken' });
- 
-      setTimeout(() => this.cleanup(), 2000);
- 
-    } catch (error) {
-      console.error('Screenshot failed:', error);
-      
-      // Provide specific error messages for screenshot failures
-      let errorMessage = 'Screenshot capture failed. Please try again.';
-      
-      if (error.message) {
-        if (error.message.includes('html2canvas')) {
-          errorMessage = 'Screenshot rendering failed. Try selecting a different element or refresh the page.';
-        } else if (error.message.includes('timeout')) {
-          errorMessage = 'Screenshot capture timed out. Try selecting a smaller area or simpler element.';
-        } else if (error.message.includes('network') || error.message.includes('CORS')) {
-          errorMessage = 'Screenshot failed: Some content is blocked by security restrictions.';
-        } else if (error.message.includes('memory') || error.message.includes('quota')) {
-          errorMessage = 'Screenshot failed: Not enough memory. Try capturing a smaller area.';
-        } else if (error.message.includes('canvas')) {
-          errorMessage = 'Screenshot failed: Unable to create image. Try a different element.';
-        }
-      }
-      
-      this.overlay.innerHTML = `
-        <div style="position: fixed; top: 20px; left: 20px; background: rgba(231, 76, 60, 0.95); color: white; padding: 12px 16px; border-radius: 8px; z-index: 2147483647; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);">
-          <div style="display: flex; align-items: center; gap: 10px;">
-            <span>❌</span>
-            <span>${errorMessage}</span>
-          </div>
-        </div>
-      `;
-      
-      // Notify popup about the failure
-      chrome.runtime.sendMessage({ action: 'selectorStopped', reason: 'screenshot-failed' });
-      
-      setTimeout(() => this.cleanup(), 3000);
-    }
-  }
- 
-  /**
-   * Check if Clipboard API is available and supported
-   * @returns {{available: boolean, reason?: string}} Clipboard API availability status
-   */
-  checkClipboardAPIAvailability() {
-    // Check for basic Clipboard API support
-    if (!navigator.clipboard) {
-      return {
-        available: false,
-        reason: 'Clipboard API not available in this browser'
-      };
-    }
- 
-    // Check for ClipboardItem constructor (required for image data)
-    if (!window.ClipboardItem) {
-      return {
-        available: false,
-        reason: 'ClipboardItem not supported in this browser'
-      };
-    }
- 
-    // Check if we're in a secure context (HTTPS required for clipboard)
-    if (!window.isSecureContext) {
-      return {
-        available: false,
-        reason: 'Clipboard API requires a secure context (HTTPS)'
-      };
-    }
- 
-    // Check for write permission (this is the basic check, actual permission is checked during write)
-    if (!navigator.clipboard.write) {
-      return {
-        available: false,
-        reason: 'Clipboard write functionality not available'
-      };
-    }
- 
-    return {
-      available: true
-    };
-  }
- 
-  /**
-   * Get user-friendly feedback message about clipboard feature availability
-   * @returns {{supported: boolean, message: string}} User feedback about clipboard support
-   */
-  getClipboardSupportFeedback() {
-    const availability = this.checkClipboardAPIAvailability();
-    
-    if (availability.available) {
-      return {
-        supported: true,
-        message: 'Clipboard copying is available and ready to use.'
-      };
-    }
- 
-    // Provide user-friendly messages for different scenarios
-    let userMessage = '';
-    
-    if (availability.reason.includes('not available') || availability.reason.includes('not supported')) {
-      userMessage = 'Your browser doesn\'t support clipboard copying. Screenshots will still be downloaded.';
-    } else if (availability.reason.includes('secure context')) {
-      userMessage = 'Clipboard copying requires HTTPS. Screenshots will still be downloaded.';
-    } else if (availability.reason.includes('write functionality')) {
-      userMessage = 'Clipboard writing is not available. Screenshots will still be downloaded.';
-    } else {
-      userMessage = 'Clipboard copying is not available. Screenshots will still be downloaded.';
-    }
- 
-    return {
-      supported: false,
-      message: userMessage
-    };
-  }
- 
-  /**
-   * Generate user-friendly error message for clipboard operation failures
-   * @param {Object} clipboardResult - Result object from clipboard operation
-   * @returns {string} User-friendly error message
-   */
-  getClipboardErrorMessage(clipboardResult) {
-    if (!clipboardResult || !clipboardResult.error) {
-      return 'Clipboard copy failed due to unknown error.';
-    }
- 
-    const errorType = clipboardResult.errorType;
-    const errorMessage = clipboardResult.error;
- 
-    // Provide contextual error messages based on error type
-    switch (errorType) {
-      case 'permission_denied':
-        return 'Clipboard copy failed: Permission denied. Please allow clipboard access in your browser settings.';
-      
-      case 'not_supported':
-      case 'api_unavailable':
-        return 'Clipboard copy not available in this browser. Screenshot was still downloaded.';
-      
-      case 'security_error':
-        return 'Clipboard copy blocked by browser security. Try using HTTPS or check site permissions.';
-      
-      case 'size_limit':
-      case 'quota_exceeded':
-        return 'Clipboard copy failed: Image too large. Try capturing a smaller area.';
-      
-      case 'timeout':
-        return 'Clipboard copy timed out. The image may be too large or complex.';
-      
-      case 'network_error':
-        return 'Clipboard copy failed due to network error. Please try again.';
-      
-      case 'canvas_conversion':
-        return 'Clipboard copy failed: Unable to prepare image. Try capturing a different element.';
-      
-      case 'clipboard_item_creation':
-        return 'Clipboard copy not supported: Your browser doesn\'t support image clipboard operations.';
-      
-      case 'invalid_state':
-        return 'Clipboard copy failed: Browser clipboard is busy. Please try again.';
-      
-      case 'data_error':
-        return 'Clipboard copy failed: Invalid image data. Please try capturing again.';
-      
-      case 'unexpected':
-        return 'Clipboard copy failed due to unexpected error. Screenshot was still downloaded.';
-      
-      default:
-        // For unknown error types, try to extract meaningful info from the error message
-        if (errorMessage.includes('permission') || errorMessage.includes('denied')) {
-          return 'Clipboard copy failed: Access denied. Check browser permissions.';
-        } else if (errorMessage.includes('not supported') || errorMessage.includes('unavailable')) {
-          return 'Clipboard copy not supported in this browser.';
-        } else if (errorMessage.includes('timeout') || errorMessage.includes('timed out')) {
-          return 'Clipboard copy timed out. Try capturing a smaller area.';
-        } else if (errorMessage.includes('large') || errorMessage.includes('size')) {
-          return 'Clipboard copy failed: Image too large for clipboard.';
-        } else {
-          return `Clipboard copy failed: ${errorMessage}`;
-        }
-    }
-  }
- 
-  /**
-   * Copy canvas content to clipboard using the Clipboard API
-   * @param {HTMLCanvasElement} canvas - The canvas element to copy
-   * @returns {Promise<{success: boolean, error?: string, errorType?: string}>} Result of clipboard operation
-   */
-  async copyCanvasToClipboard(canvas) {
-    try {
-      // Check clipboard API availability first
-      const availability = this.checkClipboardAPIAvailability();
-      if (!availability.available) {
-        return { 
-          success: false, 
-          error: availability.reason,
-          errorType: 'api_unavailable'
-        };
-      }
- 
-      // Convert canvas to blob in PNG format with timeout
-      const blob = await Promise.race([
-        new Promise((resolve, reject) => {
-          canvas.toBlob((blob) => {
-            if (blob) {
-              resolve(blob);
-            } else {
-              reject(new Error('Canvas to blob conversion returned null'));
-            }
-          }, 'image/png');
-        }),
-        new Promise((_, reject) => 
-          setTimeout(() => reject(new Error('Canvas to blob conversion timed out')), 10000)
-        )
-      ]);
- 
-      // Validate blob size (prevent extremely large clipboard operations)
-      const maxBlobSize = 50 * 1024 * 1024; // 50MB limit
-      if (blob.size > maxBlobSize) {
-        return {
-          success: false,
-          error: `Image too large for clipboard (${Math.round(blob.size / 1024 / 1024)}MB). Try capturing a smaller area.`,
-          errorType: 'size_limit'
-        };
-      }
- 
-      // Create ClipboardItem with PNG image data
-      let clipboardItem;
-      try {
-        clipboardItem = new ClipboardItem({
-          'image/png': blob
-        });
-      } catch (clipboardItemError) {
-        return {
-          success: false,
-          error: 'Failed to create clipboard item. Your browser may not support image clipboard operations.',
-          errorType: 'clipboard_item_creation'
-        };
-      }
- 
-      // Write to clipboard with timeout
-      await Promise.race([
-        navigator.clipboard.write([clipboardItem]),
-        new Promise((_, reject) => 
-          setTimeout(() => reject(new Error('Clipboard write operation timed out')), 15000)
-        )
-      ]);
- 
-      return { success: true };
- 
-    } catch (error) {
-      console.error('Clipboard operation failed:', error);
-      
-      // Comprehensive error handling with specific error types and user-friendly messages
-      let errorMessage = error.message || 'Unknown clipboard error';
-      let errorType = 'unknown';
-      
-      // Permission-related errors
-      if (error.name === 'NotAllowedError') {
-        errorMessage = 'Clipboard access denied. Please allow clipboard permissions in your browser settings.';
-        errorType = 'permission_denied';
-      } 
-      // API support errors
-      else if (error.name === 'NotSupportedError') {
-        errorMessage = 'Clipboard API not supported in this browser context.';
-        errorType = 'not_supported';
-      }
-      // Security context errors
-      else if (error.name === 'SecurityError') {
-        errorMessage = 'Clipboard access blocked by security policy. Try using HTTPS.';
-        errorType = 'security_error';
-      }
-      // Network or resource errors
-      else if (error.name === 'NetworkError') {
-        errorMessage = 'Network error during clipboard operation. Please try again.';
-        errorType = 'network_error';
-      }
-      // Timeout errors
-      else if (error.message.includes('timed out')) {
-        errorMessage = 'Clipboard operation timed out. The image may be too large.';
-        errorType = 'timeout';
-      }
-      // Canvas conversion errors
-      else if (error.message.includes('canvas') || error.message.includes('blob')) {
-        errorMessage = 'Failed to prepare image for clipboard. Try capturing a different area.';
-        errorType = 'canvas_conversion';
-      }
-      // Quota or storage errors
-      else if (error.name === 'QuotaExceededError' || error.message.includes('quota')) {
-        errorMessage = 'Clipboard storage quota exceeded. Try capturing a smaller image.';
-        errorType = 'quota_exceeded';
-      }
-      // DOM or state errors
-      else if (error.name === 'InvalidStateError') {
-        errorMessage = 'Clipboard is in an invalid state. Please try again.';
-        errorType = 'invalid_state';
-      }
-      // Data errors
-      else if (error.name === 'DataError') {
-        errorMessage = 'Invalid image data for clipboard. Please try again.';
-        errorType = 'data_error';
-      }
-      // Generic fallback for unknown errors
-      else {
-        errorMessage = `Clipboard operation failed: ${error.message}`;
-        errorType = 'unknown';
-      }
- 
-      return { 
-        success: false, 
-        error: errorMessage,
-        errorType: errorType
-      };
-    }
-  }
- 
-  cleanup() {
-    document.removeEventListener('mouseover', this.handleMouseOver);
-    document.removeEventListener('click', this.handleClick, true);
-    document.removeEventListener('keydown', this.handleKeyPress);
- 
-    if (this.currentHighlight) {
-      this.currentHighlight.classList.remove('screenshot-highlight');
-    }
- 
-    // Remove any scrollable indicators
-    this.removeScrollableIndicators();
- 
-    if (this.overlay) {
-      this.overlay.remove();
-      this.overlay = null;
-    }
- 
-    if (this.style) {
-      this.style.remove();
-      this.style = null;
-    }
- 
-    this.isActive = false;
-    this.currentHighlight = null;
-  }
-}
- 
-// Global instance
-let screenshotSelector = new ScreenshotSelector();
- 
-// Add load indicator
-console.log('Full Screenshot Selector content script loaded');
- 
-// Listen for messages from popup
-chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
-  try {
-  switch (message.action) {
-    case 'startSelector':
-      // Extract clipboard preference from message, default to true for backward compatibility
-      const copyToClipboard = message.copyToClipboard !== undefined ? message.copyToClipboard : true;
-      screenshotSelector.init(message.background, copyToClipboard);
-      sendResponse({ success: true });
-      break;
- 
-    case 'stopSelector':
-      screenshotSelector.cleanup();
-      sendResponse({ success: true });
-      break;
- 
-    case 'checkState':
-      sendResponse({ isActive: screenshotSelector.isActive });
-      break;
- 
-    case 'checkClipboardSupport':
-      const availability = screenshotSelector.checkClipboardAPIAvailability();
-      const feedback = screenshotSelector.getClipboardSupportFeedback();
-      sendResponse({ 
-        availability: availability,
-        feedback: feedback
-      });
-      break;
- 
-      default:
-        sendResponse({ error: 'Unknown action: ' + message.action });
-    }
-  } catch (error) {
-    console.error('Content script error:', error);
-    sendResponse({ error: error.message });
-  }
- 
-  // Important: return true to indicate async response
-  return true;
-});
- 
-// Handle keyboard shortcut
-chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
-  if (message.action === 'activateFromShortcut') {
-    if (!screenshotSelector.isActive) {
-      screenshotSelector.init('black', true); // Default background and clipboard enabled for shortcut
-    }
-  }
-});
- -
-
- - - - - - - - \ No newline at end of file diff --git a/coverage/favicon.png b/coverage/favicon.png deleted file mode 100644 index c1525b8..0000000 Binary files a/coverage/favicon.png and /dev/null differ diff --git a/coverage/index.html b/coverage/index.html deleted file mode 100644 index 4f0a1b0..0000000 --- a/coverage/index.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - Code coverage report for All files - - - - - - - - - -
-
-

All files

-
- -
- 0% - Statements - 0/463 -
- - -
- 0% - Branches - 0/263 -
- - -
- 0% - Functions - 0/61 -
- - -
- 0% - Lines - 0/445 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
content.js -
-
0%0/3710%0/2140%0/440%0/356
popup.js -
-
0%0/920%0/490%0/170%0/89
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/coverage/lcov-report/base.css b/coverage/lcov-report/base.css deleted file mode 100644 index f418035..0000000 --- a/coverage/lcov-report/base.css +++ /dev/null @@ -1,224 +0,0 @@ -body, html { - margin:0; padding: 0; - height: 100%; -} -body { - font-family: Helvetica Neue, Helvetica, Arial; - font-size: 14px; - color:#333; -} -.small { font-size: 12px; } -*, *:after, *:before { - -webkit-box-sizing:border-box; - -moz-box-sizing:border-box; - box-sizing:border-box; - } -h1 { font-size: 20px; margin: 0;} -h2 { font-size: 14px; } -pre { - font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; - margin: 0; - padding: 0; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; -} -a { color:#0074D9; text-decoration:none; } -a:hover { text-decoration:underline; } -.strong { font-weight: bold; } -.space-top1 { padding: 10px 0 0 0; } -.pad2y { padding: 20px 0; } -.pad1y { padding: 10px 0; } -.pad2x { padding: 0 20px; } -.pad2 { padding: 20px; } -.pad1 { padding: 10px; } -.space-left2 { padding-left:55px; } -.space-right2 { padding-right:20px; } -.center { text-align:center; } -.clearfix { display:block; } -.clearfix:after { - content:''; - display:block; - height:0; - clear:both; - visibility:hidden; - } -.fl { float: left; } -@media only screen and (max-width:640px) { - .col3 { width:100%; max-width:100%; } - .hide-mobile { display:none!important; } -} - -.quiet { - color: #7f7f7f; - color: rgba(0,0,0,0.5); -} -.quiet a { opacity: 0.7; } - -.fraction { - font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; - font-size: 10px; - color: #555; - background: #E8E8E8; - padding: 4px 5px; - border-radius: 3px; - vertical-align: middle; -} - -div.path a:link, div.path a:visited { color: #333; } -table.coverage { - border-collapse: collapse; - margin: 10px 0 0 0; - padding: 0; -} - -table.coverage td { - margin: 0; - padding: 0; - vertical-align: top; -} -table.coverage td.line-count { - text-align: right; - padding: 0 5px 0 20px; -} -table.coverage td.line-coverage { - text-align: right; - padding-right: 10px; - min-width:20px; -} - -table.coverage td span.cline-any { - display: inline-block; - padding: 0 5px; - width: 100%; -} -.missing-if-branch { - display: inline-block; - margin-right: 5px; - border-radius: 3px; - position: relative; - padding: 0 4px; - background: #333; - color: yellow; -} - -.skip-if-branch { - display: none; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: #ccc; - color: white; -} -.missing-if-branch .typ, .skip-if-branch .typ { - color: inherit !important; -} -.coverage-summary { - border-collapse: collapse; - width: 100%; -} -.coverage-summary tr { border-bottom: 1px solid #bbb; } -.keyline-all { border: 1px solid #ddd; } -.coverage-summary td, .coverage-summary th { padding: 10px; } -.coverage-summary tbody { border: 1px solid #bbb; } -.coverage-summary td { border-right: 1px solid #bbb; } -.coverage-summary td:last-child { border-right: none; } -.coverage-summary th { - text-align: left; - font-weight: normal; - white-space: nowrap; -} -.coverage-summary th.file { border-right: none !important; } -.coverage-summary th.pct { } -.coverage-summary th.pic, -.coverage-summary th.abs, -.coverage-summary td.pct, -.coverage-summary td.abs { text-align: right; } -.coverage-summary td.file { white-space: nowrap; } -.coverage-summary td.pic { min-width: 120px !important; } -.coverage-summary tfoot td { } - -.coverage-summary .sorter { - height: 10px; - width: 7px; - display: inline-block; - margin-left: 0.5em; - background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; -} -.coverage-summary .sorted .sorter { - background-position: 0 -20px; -} -.coverage-summary .sorted-desc .sorter { - background-position: 0 -10px; -} -.status-line { height: 10px; } -/* yellow */ -.cbranch-no { background: yellow !important; color: #111; } -/* dark red */ -.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } -.low .chart { border:1px solid #C21F39 } -.highlighted, -.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ - background: #C21F39 !important; -} -/* medium red */ -.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } -/* light red */ -.low, .cline-no { background:#FCE1E5 } -/* light green */ -.high, .cline-yes { background:rgb(230,245,208) } -/* medium green */ -.cstat-yes { background:rgb(161,215,106) } -/* dark green */ -.status-line.high, .high .cover-fill { background:rgb(77,146,33) } -.high .chart { border:1px solid rgb(77,146,33) } -/* dark yellow (gold) */ -.status-line.medium, .medium .cover-fill { background: #f9cd0b; } -.medium .chart { border:1px solid #f9cd0b; } -/* light yellow */ -.medium { background: #fff4c2; } - -.cstat-skip { background: #ddd; color: #111; } -.fstat-skip { background: #ddd; color: #111 !important; } -.cbranch-skip { background: #ddd !important; color: #111; } - -span.cline-neutral { background: #eaeaea; } - -.coverage-summary td.empty { - opacity: .5; - padding-top: 4px; - padding-bottom: 4px; - line-height: 1; - color: #888; -} - -.cover-fill, .cover-empty { - display:inline-block; - height: 12px; -} -.chart { - line-height: 0; -} -.cover-empty { - background: white; -} -.cover-full { - border-right: none !important; -} -pre.prettyprint { - border: none !important; - padding: 0 !important; - margin: 0 !important; -} -.com { color: #999 !important; } -.ignore-none { color: #999; font-weight: normal; } - -.wrapper { - min-height: 100%; - height: auto !important; - height: 100%; - margin: 0 auto -48px; -} -.footer, .push { - height: 48px; -} diff --git a/coverage/lcov-report/block-navigation.js b/coverage/lcov-report/block-navigation.js deleted file mode 100644 index cc12130..0000000 --- a/coverage/lcov-report/block-navigation.js +++ /dev/null @@ -1,87 +0,0 @@ -/* eslint-disable */ -var jumpToCode = (function init() { - // Classes of code we would like to highlight in the file view - var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; - - // Elements to highlight in the file listing view - var fileListingElements = ['td.pct.low']; - - // We don't want to select elements that are direct descendants of another match - var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` - - // Selecter that finds elements on the page to which we can jump - var selector = - fileListingElements.join(', ') + - ', ' + - notSelector + - missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` - - // The NodeList of matching elements - var missingCoverageElements = document.querySelectorAll(selector); - - var currentIndex; - - function toggleClass(index) { - missingCoverageElements - .item(currentIndex) - .classList.remove('highlighted'); - missingCoverageElements.item(index).classList.add('highlighted'); - } - - function makeCurrent(index) { - toggleClass(index); - currentIndex = index; - missingCoverageElements.item(index).scrollIntoView({ - behavior: 'smooth', - block: 'center', - inline: 'center' - }); - } - - function goToPrevious() { - var nextIndex = 0; - if (typeof currentIndex !== 'number' || currentIndex === 0) { - nextIndex = missingCoverageElements.length - 1; - } else if (missingCoverageElements.length > 1) { - nextIndex = currentIndex - 1; - } - - makeCurrent(nextIndex); - } - - function goToNext() { - var nextIndex = 0; - - if ( - typeof currentIndex === 'number' && - currentIndex < missingCoverageElements.length - 1 - ) { - nextIndex = currentIndex + 1; - } - - makeCurrent(nextIndex); - } - - return function jump(event) { - if ( - document.getElementById('fileSearch') === document.activeElement && - document.activeElement != null - ) { - // if we're currently focused on the search input, we don't want to navigate - return; - } - - switch (event.which) { - case 78: // n - case 74: // j - goToNext(); - break; - case 66: // b - case 75: // k - case 80: // p - goToPrevious(); - break; - } - }; -})(); -window.addEventListener('keydown', jumpToCode); diff --git a/coverage/lcov-report/content.js.html b/coverage/lcov-report/content.js.html deleted file mode 100644 index adf9f32..0000000 --- a/coverage/lcov-report/content.js.html +++ /dev/null @@ -1,2893 +0,0 @@ - - - - - - Code coverage report for content.js - - - - - - - - - -
-
-

All files content.js

-
- -
- 0% - Statements - 0/371 -
- - -
- 0% - Branches - 0/214 -
- - -
- 0% - Functions - 0/44 -
- - -
- 0% - Lines - 0/356 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466 -467 -468 -469 -470 -471 -472 -473 -474 -475 -476 -477 -478 -479 -480 -481 -482 -483 -484 -485 -486 -487 -488 -489 -490 -491 -492 -493 -494 -495 -496 -497 -498 -499 -500 -501 -502 -503 -504 -505 -506 -507 -508 -509 -510 -511 -512 -513 -514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526 -527 -528 -529 -530 -531 -532 -533 -534 -535 -536 -537 -538 -539 -540 -541 -542 -543 -544 -545 -546 -547 -548 -549 -550 -551 -552 -553 -554 -555 -556 -557 -558 -559 -560 -561 -562 -563 -564 -565 -566 -567 -568 -569 -570 -571 -572 -573 -574 -575 -576 -577 -578 -579 -580 -581 -582 -583 -584 -585 -586 -587 -588 -589 -590 -591 -592 -593 -594 -595 -596 -597 -598 -599 -600 -601 -602 -603 -604 -605 -606 -607 -608 -609 -610 -611 -612 -613 -614 -615 -616 -617 -618 -619 -620 -621 -622 -623 -624 -625 -626 -627 -628 -629 -630 -631 -632 -633 -634 -635 -636 -637 -638 -639 -640 -641 -642 -643 -644 -645 -646 -647 -648 -649 -650 -651 -652 -653 -654 -655 -656 -657 -658 -659 -660 -661 -662 -663 -664 -665 -666 -667 -668 -669 -670 -671 -672 -673 -674 -675 -676 -677 -678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -695 -696 -697 -698 -699 -700 -701 -702 -703 -704 -705 -706 -707 -708 -709 -710 -711 -712 -713 -714 -715 -716 -717 -718 -719 -720 -721 -722 -723 -724 -725 -726 -727 -728 -729 -730 -731 -732 -733 -734 -735 -736 -737 -738 -739 -740 -741 -742 -743 -744 -745 -746 -747 -748 -749 -750 -751 -752 -753 -754 -755 -756 -757 -758 -759 -760 -761 -762 -763 -764 -765 -766 -767 -768 -769 -770 -771 -772 -773 -774 -775 -776 -777 -778 -779 -780 -781 -782 -783 -784 -785 -786 -787 -788 -789 -790 -791 -792 -793 -794 -795 -796 -797 -798 -799 -800 -801 -802 -803 -804 -805 -806 -807 -808 -809 -810 -811 -812 -813 -814 -815 -816 -817 -818 -819 -820 -821 -822 -823 -824 -825 -826 -827 -828 -829 -830 -831 -832 -833 -834 -835 -836 -837 -838 -839 -840 -841 -842 -843 -844 -845 -846 -847 -848 -849 -850 -851 -852 -853 -854 -855 -856 -857 -858 -859 -860 -861 -862 -863 -864 -865 -866 -867 -868 -869 -870 -871 -872 -873 -874 -875 -876 -877 -878 -879 -880 -881 -882 -883 -884 -885 -886 -887 -888 -889 -890 -891 -892 -893 -894 -895 -896 -897 -898 -899 -900 -901 -902 -903 -904 -905 -906 -907 -908 -909 -910 -911 -912 -913 -914 -915 -916 -917 -918 -919 -920 -921 -922 -923 -924 -925 -926 -927 -928 -929 -930 -931 -932 -933 -934 -935 -936 -937  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 
// Content script for Full Screenshot Selector Chrome Extension
-class ScreenshotSelector {
-  constructor() {
-    this.isActive = false;
-    this.currentHighlight = null;
-    this.overlay = null;
-    this.style = null;
-    this.background = 'black';
-    this.copyToClipboard = true; // Default to true
-  }
- 
-  async init(background = 'black', copyToClipboard = true) {
-    if (this.isActive) {
-      console.log('Screenshot selector already active');
-      return;
-    }
- 
-    this.background = background;
-    this.copyToClipboard = copyToClipboard;
-    this.isActive = true;
- 
-    this.createUI();
-    this.addEventListeners();
-  }
- 
-  createUI() {
-    // Create overlay UI
-    this.overlay = document.createElement('div');
-    this.overlay.id = 'screenshot-selector-overlay';
-    this.overlay.innerHTML = `
-      <div style="position: fixed; top: 20px; left: 20px; background: rgba(0,0,0,0.9); color: white; padding: 12px 16px; border-radius: 8px; z-index: 2147483647; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); backdrop-filter: blur(10px);">
-        <div style="display: flex; align-items: center; gap: 10px;">
-          <span>📸</span>
-          <span>Hover over elements and click to capture</span>
-          <button id="screenshot-cancel" style="margin-left: 10px; padding: 4px 8px; background: #ff4757; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 12px;">ESC</button>
-        </div>
-      </div>
-    `;
- 
-    // Add hover highlighting styles
-    this.style = document.createElement('style');
-    this.style.textContent = `
-      .screenshot-highlight {
-        outline: 3px solid #00d2ff !important;
-        outline-offset: 2px !important;
-        cursor: crosshair !important;
-        position: relative !important;
-      }
-      .screenshot-highlight::after {
-        content: '';
-        position: absolute;
-        top: -5px;
-        left: -5px;
-        right: -5px;
-        bottom: -5px;
-        background: rgba(0, 210, 255, 0.1) !important;
-        pointer-events: none !important;
-        z-index: 2147483646 !important;
-      }
-      .screenshot-scrollable-indicator {
-        position: absolute !important;
-        border: 2px dotted #ff6b6b !important;
-        background: rgba(255, 107, 107, 0.05) !important;
-        pointer-events: none !important;
-        z-index: 2147483645 !important;
-      }
-      #screenshot-selector-overlay * {
-        cursor: default !important;
-      }
-    `;
- 
-    document.head.appendChild(this.style);
-    document.body.appendChild(this.overlay);
- 
-    // Cancel button functionality
-    document.getElementById('screenshot-cancel').onclick = () => this.cleanup();
-  }
- 
-  addEventListeners() {
-    this.handleMouseOver = this.handleMouseOver.bind(this);
-    this.handleClick = this.handleClick.bind(this);
-    this.handleKeyPress = this.handleKeyPress.bind(this);
- 
-    document.addEventListener('mouseover', this.handleMouseOver);
-    document.addEventListener('click', this.handleClick, true);
-    document.addEventListener('keydown', this.handleKeyPress);
-  }
- 
-  handleMouseOver(e) {
-    if (e.target.closest('#screenshot-selector-overlay')) return;
- 
-    // Clean up previous highlights and indicators
-    if (this.currentHighlight) {
-      this.currentHighlight.classList.remove('screenshot-highlight');
-      this.removeScrollableIndicators();
-    }
- 
-    this.currentHighlight = e.target;
-    e.target.classList.add('screenshot-highlight');
- 
-    // Add scrollable content indicators
-    this.addScrollableIndicators(e.target);
-  }
- 
-  handleClick(e) {
-    if (e.target.closest('#screenshot-selector-overlay')) return;
-    e.preventDefault();
-    e.stopPropagation();
- 
-    const element = e.target;
-    this.captureElement(element);
-  }
- 
-  handleKeyPress(e) {
-    if (e.key === 'Escape') {
-      this.cleanup();
-    }
-  }
- 
-  addScrollableIndicators(element) {
-    const rect = element.getBoundingClientRect();
-    const hasVerticalScroll = element.scrollHeight > element.clientHeight;
-    const hasHorizontalScroll = element.scrollWidth > element.clientWidth;
- 
-    if (!hasVerticalScroll && !hasHorizontalScroll) return;
- 
-    // Calculate the full content dimensions
-    const fullHeight = element.scrollHeight;
-    const fullWidth = element.scrollWidth;
-    const visibleHeight = element.clientHeight;
-    const visibleWidth = element.clientWidth;
- 
-    // Create indicator for full scrollable area
-    if (hasVerticalScroll || hasHorizontalScroll) {
-      const indicator = document.createElement('div');
-      indicator.className = 'screenshot-scrollable-indicator';
-      indicator.setAttribute('data-screenshot-indicator', 'true');
- 
-      // Position it relative to the viewport
-      const style = {
-        left: `${rect.left}px`,
-        top: `${rect.top}px`,
-        width: hasHorizontalScroll ? `${fullWidth}px` : `${rect.width}px`,
-        height: hasVerticalScroll ? `${fullHeight}px` : `${rect.height}px`,
-      };
- 
-      Object.assign(indicator.style, style);
-      document.body.appendChild(indicator);
- 
-      // Add a label to show the full dimensions
-      const label = document.createElement('div');
-      label.setAttribute('data-screenshot-indicator', 'true');
-      label.style.cssText = `
-        position: fixed;
-        top: ${rect.top - 25}px;
-        left: ${rect.left}px;
-        background: rgba(255, 107, 107, 0.9);
-        color: white;
-        padding: 2px 6px;
-        border-radius: 3px;
-        font-size: 11px;
-        font-family: monospace;
-        z-index: 2147483647;
-        pointer-events: none;
-      `;
- 
-      const scrollInfo = [];
-      if (hasVerticalScroll) scrollInfo.push(`H: ${fullHeight}px (visible: ${visibleHeight}px)`);
-      if (hasHorizontalScroll) scrollInfo.push(`W: ${fullWidth}px (visible: ${visibleWidth}px)`);
-      label.textContent = `Full content - ${scrollInfo.join(', ')}`;
- 
-      document.body.appendChild(label);
-    }
-  }
- 
-  removeScrollableIndicators() {
-    const indicators = document.querySelectorAll('[data-screenshot-indicator]');
-    indicators.forEach(indicator => indicator.remove());
-  }
- 
-  // Helper method to generate a unique selector for an element
-  getElementSelector(element) {
-    // Escape helper for CSS identifiers (handles Tailwind classes like lg:pr-0)
-    const escapeIdent = (ident) => {
-      try {
-        if (window.CSS && typeof window.CSS.escape === 'function') {
-          return window.CSS.escape(ident);
-        }
-      } catch (_) {}
-      // Fallback: escape most punctuation characters
-      return String(ident).replace(/([ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '\\$1');
-    };
- 
-    if (element.id) {
-      return `#${escapeIdent(element.id)}`;
-    }
- 
-    if (element.classList && element.classList.length) {
-      const classSelector = Array.from(element.classList)
-        .filter(Boolean)
-        .map(cls => `.${escapeIdent(cls)}`)
-        .join('');
-      if (classSelector) {
-        return `${element.tagName.toLowerCase()}${classSelector}`;
-      }
-    }
- 
-    // Fallback to tag name and position
-    const siblings = Array.from(element.parentNode?.children || []);
-    const index = siblings.indexOf(element);
-    return `${element.tagName.toLowerCase()}:nth-child(${index + 1})`;
-  }
- 
-    // Preserve computed styles for better rendering
-  preserveComputedStyles(clonedElement, originalElement) {
-    if (!originalElement || !clonedElement) return;
- 
-    const computedStyle = window.getComputedStyle(originalElement);
- 
-    // Comprehensive style properties including layout and icon-related ones
-    const importantStyles = [
-      // Typography and fonts
-      'font-family', 'font-size', 'font-weight', 'font-style', 'font-variant',
-      'text-align', 'text-decoration', 'text-transform', 'text-indent',
-      'line-height', 'letter-spacing', 'word-spacing', 'white-space',
- 
-      // Colors and backgrounds
-      'color', 'background-color', 'background-image', 'background-size',
-      'background-position', 'background-repeat', 'background-attachment',
- 
-      // Layout and positioning
-      'display', 'position', 'top', 'left', 'right', 'bottom',
-      'width', 'height', 'min-width', 'min-height', 'max-width', 'max-height',
-      'margin', 'padding', 'border', 'border-radius',
-      'float', 'clear', 'vertical-align',
- 
-      // Flexbox and Grid
-      'flex', 'flex-direction', 'flex-wrap', 'flex-basis', 'flex-grow', 'flex-shrink',
-      'justify-content', 'align-items', 'align-self', 'align-content',
-      'grid', 'grid-template', 'grid-area', 'grid-column', 'grid-row',
- 
-      // Visual effects
-      'opacity', 'visibility', 'overflow', 'overflow-x', 'overflow-y',
-      'box-shadow', 'text-shadow', 'transform', 'filter',
-      'z-index', 'cursor'
-    ];
- 
-    // Apply computed styles
-    importantStyles.forEach(property => {
-      const value = computedStyle.getPropertyValue(property);
-      if (value && value !== 'none' && value !== 'normal' && value !== 'auto' && value !== 'initial') {
-        try {
-          clonedElement.style.setProperty(property, value, 'important');
-        } catch (e) {
-          // Skip properties that can't be set
-        }
-      }
-    });
- 
-    // Handle pseudo-elements (::before and ::after) which often contain icons
-    this.preservePseudoElements(clonedElement, originalElement);
- 
-    // Recursively apply to children
-    const originalChildren = Array.from(originalElement.children);
-    const clonedChildren = Array.from(clonedElement.children);
- 
-    for (let i = 0; i < Math.min(originalChildren.length, clonedChildren.length); i++) {
-      this.preserveComputedStyles(clonedChildren[i], originalChildren[i]);
-    }
-  }
- 
-     // Handle pseudo-elements that often contain icons
-   preservePseudoElements(clonedElement, originalElement) {
-     try {
-       ['::before', '::after'].forEach(pseudo => {
-         const pseudoStyle = window.getComputedStyle(originalElement, pseudo);
-         const content = pseudoStyle.getPropertyValue('content');
- 
-         // If pseudo-element has content, try to preserve it
-         if (content && content !== 'none' && content !== '""') {
-           const pseudoProperties = [
-             'content', 'display', 'position', 'top', 'left', 'right', 'bottom',
-             'width', 'height', 'font-family', 'font-size', 'color',
-             'background-color', 'background-image', 'border', 'border-radius',
-             'transform', 'opacity'
-           ];
- 
-           // Create inline style for pseudo-element
-           let selector = this.getElementSelector(clonedElement);
-           let pseudoCSS = `${selector}${pseudo} {`;
-           pseudoProperties.forEach(prop => {
-             const value = pseudoStyle.getPropertyValue(prop);
-             if (value && value !== 'none' && value !== 'normal') {
-               pseudoCSS += `${prop}: ${value} !important;`;
-             }
-           });
-           pseudoCSS += '}';
- 
-           // Add to document head
-           const style = document.createElement('style');
-           style.textContent = pseudoCSS;
-           document.head.appendChild(style);
-         }
-       });
-     } catch (e) {
-       // Pseudo-element handling failed, continue without it
-     }
-   }
- 
-   // Wait for fonts and resources to load properly
-   async waitForFontsAndResources(element) {
-     // Wait for document fonts to load
-     if (document.fonts && document.fonts.ready) {
-       try {
-         await document.fonts.ready;
-       } catch (e) {
-         // Font loading API not available or failed
-       }
-     }
- 
-     // Check for icon fonts (Font Awesome, Material Icons, etc.)
-     const iconFontFamilies = [
-       'FontAwesome', 'Font Awesome', 'Font Awesome 5', 'Font Awesome 6',
-       'Material Icons', 'Material Icons Outlined', 'Material Icons Sharp',
-       'Ionicons', 'Feather', 'Lucide', 'Tabler Icons'
-     ];
- 
-     // Force load any icon fonts found in the element
-     const allElements = [element, ...element.querySelectorAll('*')];
-     const fontPromises = [];
- 
-     allElements.forEach(el => {
-       const computedStyle = window.getComputedStyle(el);
-       const fontFamily = computedStyle.fontFamily;
- 
-       iconFontFamilies.forEach(iconFont => {
-         if (fontFamily.includes(iconFont)) {
-           // Create a test element to ensure font is loaded
-           const testEl = document.createElement('span');
-           testEl.style.fontFamily = iconFont;
-           testEl.style.position = 'absolute';
-           testEl.style.left = '-9999px';
-           testEl.textContent = '■'; // Use a test character
-           document.body.appendChild(testEl);
- 
-           const fontPromise = new Promise(resolve => {
-             setTimeout(() => {
-               document.body.removeChild(testEl);
-               resolve();
-             }, 100);
-           });
-           fontPromises.push(fontPromise);
-         }
-       });
-     });
- 
-     // Wait for all font loading attempts
-     await Promise.all(fontPromises);
- 
-         // Additional wait for any remaining resources
-    await new Promise(resolve => setTimeout(resolve, 500));
-  }
- 
- 
- 
-  async captureElement(element) {
-    try {
-      // Determine loading message based on clipboard settings
-      let loadingMessage = 'Capturing screenshot...';
-      if (this.copyToClipboard) {
-        const availability = this.checkClipboardAPIAvailability();
-        if (availability.available) {
-          loadingMessage = 'Capturing screenshot and preparing for clipboard...';
-        } else {
-          loadingMessage = 'Capturing screenshot... (Clipboard not available)';
-        }
-      }
- 
-      // Show loading state
-      this.overlay.innerHTML = `
-        <div style="position: fixed; top: 20px; left: 20px; background: rgba(0,0,0,0.9); color: white; padding: 12px 16px; border-radius: 8px; z-index: 2147483647; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);">
-          <div style="display: flex; align-items: center; gap: 10px;">
-            <div style="width: 16px; height: 16px; border: 2px solid #fff; border-top: 2px solid transparent; border-radius: 50%; animation: spin 1s linear infinite;"></div>
-            <span>${loadingMessage}</span>
-          </div>
-        </div>
-        <style>
-          @keyframes spin {
-            0% { transform: rotate(0deg); }
-            100% { transform: rotate(360deg); }
-          }
-        </style>
-      `;
- 
-      // Remove highlight for clean capture first
-      element.classList.remove('screenshot-highlight');
-      this.removeScrollableIndicators();
- 
-      // Store original styles
-      const originalStyles = {
-        overflow: element.style.overflow,
-        overflowY: element.style.overflowY,
-        overflowX: element.style.overflowX,
-        height: element.style.height,
-        maxHeight: element.style.maxHeight,
-        position: element.style.position,
-        zIndex: element.style.zIndex,
-      };
- 
-      // Temporarily modify element for full capture
-      element.style.overflow = 'visible';
-      element.style.overflowY = 'visible';
-      element.style.overflowX = 'visible';
-      element.style.height = `${element.scrollHeight}px`;
-      element.style.maxHeight = 'none';
- 
-      // Wait for fonts and external resources to load
-      await this.waitForFontsAndResources(element);
- 
-            // Enhanced html2canvas configuration
-      const canvas = await html2canvas(element, {
-        useCORS: true,
-        allowTaint: false,
-        backgroundColor: this.background === 'transparent' ? null :
-                        this.background === 'white' ? '#ffffff' : '#000000',
- 
-        // Improved rendering options
-        scale: window.devicePixelRatio || 1, // Use device pixel ratio for crisp images
-        logging: false, // Disable logging for cleaner console
- 
-        // Better handling of external resources
-        imageTimeout: 15000, // Wait longer for images to load
- 
-        // Font handling and style preservation
-        onclone: (clonedDoc, clonedElementParam) => {
-          // Ensure all stylesheets are loaded in cloned document
-          const originalStyleSheets = Array.from(document.styleSheets);
-          const clonedHead = clonedDoc.head;
- 
-          // Copy all stylesheets to cloned document
-          originalStyleSheets.forEach(styleSheet => {
-            try {
-              if (styleSheet.href) {
-                // External stylesheet
-                const link = clonedDoc.createElement('link');
-                link.rel = 'stylesheet';
-                link.href = styleSheet.href;
-                link.type = 'text/css';
-                clonedHead.appendChild(link);
-              } else if (styleSheet.ownerNode && styleSheet.ownerNode.tagName === 'STYLE') {
-                // Inline stylesheet
-                const style = clonedDoc.createElement('style');
-                style.type = 'text/css';
-                try {
-                  const cssText = Array.from(styleSheet.cssRules).map(rule => rule.cssText).join('\n');
-                  style.textContent = cssText;
-                } catch (e) {
-                  // Fallback to original text content
-                  style.textContent = styleSheet.ownerNode.textContent;
-                }
-                clonedHead.appendChild(style);
-              }
-            } catch (e) {
-              // Skip stylesheets that can't be accessed (CORS issues)
-              console.log('Skipped stylesheet due to CORS:', e);
-            }
-          });
- 
-          // Apply computed styles to preserve appearance
-          const clonedElement = clonedElementParam;
-          const originalElement = element; // from outer scope
-          if (clonedElement && originalElement) {
-            this.preserveComputedStyles(clonedElement, originalElement);
-          }
- 
-          return clonedDoc;
-        }
-      });
- 
-      // Restore original styles
-      Object.assign(element.style, originalStyles);
- 
-      // Always download the image first (core functionality)
-      const link = document.createElement('a');
-      link.href = canvas.toDataURL('image/png');
-      link.download = `screenshot-${new Date().toISOString().slice(0, 19).replace(/[:.]/g, '-')}.png`;
-      link.click();
- 
-      // Handle clipboard operations if enabled (after successful canvas generation and download)
-      let clipboardResult = null;
-      if (this.copyToClipboard) {
-        const availability = this.checkClipboardAPIAvailability();
-        if (availability.available) {
-          try {
-            // Attempt clipboard operation with comprehensive error handling
-            clipboardResult = await this.copyCanvasToClipboard(canvas);
-          } catch (error) {
-            // Ensure clipboard errors don't break the workflow - this is a safety net
-            // The copyCanvasToClipboard method should handle all errors internally
-            console.error('Unexpected clipboard error caught in captureElement:', error);
-            clipboardResult = { 
-              success: false, 
-              error: 'Unexpected clipboard error occurred',
-              errorType: 'unexpected'
-            };
-          }
-        } else {
-          clipboardResult = { 
-            success: false, 
-            error: availability.reason,
-            errorType: 'api_unavailable'
-          };
-        }
-      }
- 
-      // Generate user feedback message based on clipboard results
-      let successMessage = 'Screenshot downloaded successfully!';
-      let messageColor = 'rgba(39, 174, 96, 0.95)'; // Green for success
-      
-      if (this.copyToClipboard) {
-        if (clipboardResult && clipboardResult.success) {
-          successMessage = 'Screenshot downloaded and copied to clipboard!';
-          // Keep green color for full success
-        } else {
-          // Download succeeded but clipboard failed - provide specific error feedback
-          const errorMessage = this.getClipboardErrorMessage(clipboardResult);
-          successMessage = `Screenshot downloaded successfully! ${errorMessage}`;
-          messageColor = 'rgba(243, 156, 18, 0.95)'; // Orange for partial success
-        }
-      }
- 
-      this.overlay.innerHTML = `
-        <div style="position: fixed; top: 20px; left: 20px; background: ${messageColor}; color: white; padding: 12px 16px; border-radius: 8px; z-index: 2147483647; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);">
-          <div style="display: flex; align-items: center; gap: 10px;">
-            <span>✅</span>
-            <span>${successMessage}</span>
-          </div>
-        </div>
-      `;
- 
-      // Notify popup
-      chrome.runtime.sendMessage({ action: 'selectorStopped', reason: 'screenshot-taken' });
- 
-      setTimeout(() => this.cleanup(), 2000);
- 
-    } catch (error) {
-      console.error('Screenshot failed:', error);
-      
-      // Provide specific error messages for screenshot failures
-      let errorMessage = 'Screenshot capture failed. Please try again.';
-      
-      if (error.message) {
-        if (error.message.includes('html2canvas')) {
-          errorMessage = 'Screenshot rendering failed. Try selecting a different element or refresh the page.';
-        } else if (error.message.includes('timeout')) {
-          errorMessage = 'Screenshot capture timed out. Try selecting a smaller area or simpler element.';
-        } else if (error.message.includes('network') || error.message.includes('CORS')) {
-          errorMessage = 'Screenshot failed: Some content is blocked by security restrictions.';
-        } else if (error.message.includes('memory') || error.message.includes('quota')) {
-          errorMessage = 'Screenshot failed: Not enough memory. Try capturing a smaller area.';
-        } else if (error.message.includes('canvas')) {
-          errorMessage = 'Screenshot failed: Unable to create image. Try a different element.';
-        }
-      }
-      
-      this.overlay.innerHTML = `
-        <div style="position: fixed; top: 20px; left: 20px; background: rgba(231, 76, 60, 0.95); color: white; padding: 12px 16px; border-radius: 8px; z-index: 2147483647; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);">
-          <div style="display: flex; align-items: center; gap: 10px;">
-            <span>❌</span>
-            <span>${errorMessage}</span>
-          </div>
-        </div>
-      `;
-      
-      // Notify popup about the failure
-      chrome.runtime.sendMessage({ action: 'selectorStopped', reason: 'screenshot-failed' });
-      
-      setTimeout(() => this.cleanup(), 3000);
-    }
-  }
- 
-  /**
-   * Check if Clipboard API is available and supported
-   * @returns {{available: boolean, reason?: string}} Clipboard API availability status
-   */
-  checkClipboardAPIAvailability() {
-    // Check for basic Clipboard API support
-    if (!navigator.clipboard) {
-      return {
-        available: false,
-        reason: 'Clipboard API not available in this browser'
-      };
-    }
- 
-    // Check for ClipboardItem constructor (required for image data)
-    if (!window.ClipboardItem) {
-      return {
-        available: false,
-        reason: 'ClipboardItem not supported in this browser'
-      };
-    }
- 
-    // Check if we're in a secure context (HTTPS required for clipboard)
-    if (!window.isSecureContext) {
-      return {
-        available: false,
-        reason: 'Clipboard API requires a secure context (HTTPS)'
-      };
-    }
- 
-    // Check for write permission (this is the basic check, actual permission is checked during write)
-    if (!navigator.clipboard.write) {
-      return {
-        available: false,
-        reason: 'Clipboard write functionality not available'
-      };
-    }
- 
-    return {
-      available: true
-    };
-  }
- 
-  /**
-   * Get user-friendly feedback message about clipboard feature availability
-   * @returns {{supported: boolean, message: string}} User feedback about clipboard support
-   */
-  getClipboardSupportFeedback() {
-    const availability = this.checkClipboardAPIAvailability();
-    
-    if (availability.available) {
-      return {
-        supported: true,
-        message: 'Clipboard copying is available and ready to use.'
-      };
-    }
- 
-    // Provide user-friendly messages for different scenarios
-    let userMessage = '';
-    
-    if (availability.reason.includes('not available') || availability.reason.includes('not supported')) {
-      userMessage = 'Your browser doesn\'t support clipboard copying. Screenshots will still be downloaded.';
-    } else if (availability.reason.includes('secure context')) {
-      userMessage = 'Clipboard copying requires HTTPS. Screenshots will still be downloaded.';
-    } else if (availability.reason.includes('write functionality')) {
-      userMessage = 'Clipboard writing is not available. Screenshots will still be downloaded.';
-    } else {
-      userMessage = 'Clipboard copying is not available. Screenshots will still be downloaded.';
-    }
- 
-    return {
-      supported: false,
-      message: userMessage
-    };
-  }
- 
-  /**
-   * Generate user-friendly error message for clipboard operation failures
-   * @param {Object} clipboardResult - Result object from clipboard operation
-   * @returns {string} User-friendly error message
-   */
-  getClipboardErrorMessage(clipboardResult) {
-    if (!clipboardResult || !clipboardResult.error) {
-      return 'Clipboard copy failed due to unknown error.';
-    }
- 
-    const errorType = clipboardResult.errorType;
-    const errorMessage = clipboardResult.error;
- 
-    // Provide contextual error messages based on error type
-    switch (errorType) {
-      case 'permission_denied':
-        return 'Clipboard copy failed: Permission denied. Please allow clipboard access in your browser settings.';
-      
-      case 'not_supported':
-      case 'api_unavailable':
-        return 'Clipboard copy not available in this browser. Screenshot was still downloaded.';
-      
-      case 'security_error':
-        return 'Clipboard copy blocked by browser security. Try using HTTPS or check site permissions.';
-      
-      case 'size_limit':
-      case 'quota_exceeded':
-        return 'Clipboard copy failed: Image too large. Try capturing a smaller area.';
-      
-      case 'timeout':
-        return 'Clipboard copy timed out. The image may be too large or complex.';
-      
-      case 'network_error':
-        return 'Clipboard copy failed due to network error. Please try again.';
-      
-      case 'canvas_conversion':
-        return 'Clipboard copy failed: Unable to prepare image. Try capturing a different element.';
-      
-      case 'clipboard_item_creation':
-        return 'Clipboard copy not supported: Your browser doesn\'t support image clipboard operations.';
-      
-      case 'invalid_state':
-        return 'Clipboard copy failed: Browser clipboard is busy. Please try again.';
-      
-      case 'data_error':
-        return 'Clipboard copy failed: Invalid image data. Please try capturing again.';
-      
-      case 'unexpected':
-        return 'Clipboard copy failed due to unexpected error. Screenshot was still downloaded.';
-      
-      default:
-        // For unknown error types, try to extract meaningful info from the error message
-        if (errorMessage.includes('permission') || errorMessage.includes('denied')) {
-          return 'Clipboard copy failed: Access denied. Check browser permissions.';
-        } else if (errorMessage.includes('not supported') || errorMessage.includes('unavailable')) {
-          return 'Clipboard copy not supported in this browser.';
-        } else if (errorMessage.includes('timeout') || errorMessage.includes('timed out')) {
-          return 'Clipboard copy timed out. Try capturing a smaller area.';
-        } else if (errorMessage.includes('large') || errorMessage.includes('size')) {
-          return 'Clipboard copy failed: Image too large for clipboard.';
-        } else {
-          return `Clipboard copy failed: ${errorMessage}`;
-        }
-    }
-  }
- 
-  /**
-   * Copy canvas content to clipboard using the Clipboard API
-   * @param {HTMLCanvasElement} canvas - The canvas element to copy
-   * @returns {Promise<{success: boolean, error?: string, errorType?: string}>} Result of clipboard operation
-   */
-  async copyCanvasToClipboard(canvas) {
-    try {
-      // Check clipboard API availability first
-      const availability = this.checkClipboardAPIAvailability();
-      if (!availability.available) {
-        return { 
-          success: false, 
-          error: availability.reason,
-          errorType: 'api_unavailable'
-        };
-      }
- 
-      // Convert canvas to blob in PNG format with timeout
-      const blob = await Promise.race([
-        new Promise((resolve, reject) => {
-          canvas.toBlob((blob) => {
-            if (blob) {
-              resolve(blob);
-            } else {
-              reject(new Error('Canvas to blob conversion returned null'));
-            }
-          }, 'image/png');
-        }),
-        new Promise((_, reject) => 
-          setTimeout(() => reject(new Error('Canvas to blob conversion timed out')), 10000)
-        )
-      ]);
- 
-      // Validate blob size (prevent extremely large clipboard operations)
-      const maxBlobSize = 50 * 1024 * 1024; // 50MB limit
-      if (blob.size > maxBlobSize) {
-        return {
-          success: false,
-          error: `Image too large for clipboard (${Math.round(blob.size / 1024 / 1024)}MB). Try capturing a smaller area.`,
-          errorType: 'size_limit'
-        };
-      }
- 
-      // Create ClipboardItem with PNG image data
-      let clipboardItem;
-      try {
-        clipboardItem = new ClipboardItem({
-          'image/png': blob
-        });
-      } catch (clipboardItemError) {
-        return {
-          success: false,
-          error: 'Failed to create clipboard item. Your browser may not support image clipboard operations.',
-          errorType: 'clipboard_item_creation'
-        };
-      }
- 
-      // Write to clipboard with timeout
-      await Promise.race([
-        navigator.clipboard.write([clipboardItem]),
-        new Promise((_, reject) => 
-          setTimeout(() => reject(new Error('Clipboard write operation timed out')), 15000)
-        )
-      ]);
- 
-      return { success: true };
- 
-    } catch (error) {
-      console.error('Clipboard operation failed:', error);
-      
-      // Comprehensive error handling with specific error types and user-friendly messages
-      let errorMessage = error.message || 'Unknown clipboard error';
-      let errorType = 'unknown';
-      
-      // Permission-related errors
-      if (error.name === 'NotAllowedError') {
-        errorMessage = 'Clipboard access denied. Please allow clipboard permissions in your browser settings.';
-        errorType = 'permission_denied';
-      } 
-      // API support errors
-      else if (error.name === 'NotSupportedError') {
-        errorMessage = 'Clipboard API not supported in this browser context.';
-        errorType = 'not_supported';
-      }
-      // Security context errors
-      else if (error.name === 'SecurityError') {
-        errorMessage = 'Clipboard access blocked by security policy. Try using HTTPS.';
-        errorType = 'security_error';
-      }
-      // Network or resource errors
-      else if (error.name === 'NetworkError') {
-        errorMessage = 'Network error during clipboard operation. Please try again.';
-        errorType = 'network_error';
-      }
-      // Timeout errors
-      else if (error.message.includes('timed out')) {
-        errorMessage = 'Clipboard operation timed out. The image may be too large.';
-        errorType = 'timeout';
-      }
-      // Canvas conversion errors
-      else if (error.message.includes('canvas') || error.message.includes('blob')) {
-        errorMessage = 'Failed to prepare image for clipboard. Try capturing a different area.';
-        errorType = 'canvas_conversion';
-      }
-      // Quota or storage errors
-      else if (error.name === 'QuotaExceededError' || error.message.includes('quota')) {
-        errorMessage = 'Clipboard storage quota exceeded. Try capturing a smaller image.';
-        errorType = 'quota_exceeded';
-      }
-      // DOM or state errors
-      else if (error.name === 'InvalidStateError') {
-        errorMessage = 'Clipboard is in an invalid state. Please try again.';
-        errorType = 'invalid_state';
-      }
-      // Data errors
-      else if (error.name === 'DataError') {
-        errorMessage = 'Invalid image data for clipboard. Please try again.';
-        errorType = 'data_error';
-      }
-      // Generic fallback for unknown errors
-      else {
-        errorMessage = `Clipboard operation failed: ${error.message}`;
-        errorType = 'unknown';
-      }
- 
-      return { 
-        success: false, 
-        error: errorMessage,
-        errorType: errorType
-      };
-    }
-  }
- 
-  cleanup() {
-    document.removeEventListener('mouseover', this.handleMouseOver);
-    document.removeEventListener('click', this.handleClick, true);
-    document.removeEventListener('keydown', this.handleKeyPress);
- 
-    if (this.currentHighlight) {
-      this.currentHighlight.classList.remove('screenshot-highlight');
-    }
- 
-    // Remove any scrollable indicators
-    this.removeScrollableIndicators();
- 
-    if (this.overlay) {
-      this.overlay.remove();
-      this.overlay = null;
-    }
- 
-    if (this.style) {
-      this.style.remove();
-      this.style = null;
-    }
- 
-    this.isActive = false;
-    this.currentHighlight = null;
-  }
-}
- 
-// Global instance
-let screenshotSelector = new ScreenshotSelector();
- 
-// Add load indicator
-console.log('Full Screenshot Selector content script loaded');
- 
-// Listen for messages from popup
-chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
-  try {
-  switch (message.action) {
-    case 'startSelector':
-      // Extract clipboard preference from message, default to true for backward compatibility
-      const copyToClipboard = message.copyToClipboard !== undefined ? message.copyToClipboard : true;
-      screenshotSelector.init(message.background, copyToClipboard);
-      sendResponse({ success: true });
-      break;
- 
-    case 'stopSelector':
-      screenshotSelector.cleanup();
-      sendResponse({ success: true });
-      break;
- 
-    case 'checkState':
-      sendResponse({ isActive: screenshotSelector.isActive });
-      break;
- 
-    case 'checkClipboardSupport':
-      const availability = screenshotSelector.checkClipboardAPIAvailability();
-      const feedback = screenshotSelector.getClipboardSupportFeedback();
-      sendResponse({ 
-        availability: availability,
-        feedback: feedback
-      });
-      break;
- 
-      default:
-        sendResponse({ error: 'Unknown action: ' + message.action });
-    }
-  } catch (error) {
-    console.error('Content script error:', error);
-    sendResponse({ error: error.message });
-  }
- 
-  // Important: return true to indicate async response
-  return true;
-});
- 
-// Handle keyboard shortcut
-chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
-  if (message.action === 'activateFromShortcut') {
-    if (!screenshotSelector.isActive) {
-      screenshotSelector.init('black', true); // Default background and clipboard enabled for shortcut
-    }
-  }
-});
- -
-
- - - - - - - - \ No newline at end of file diff --git a/coverage/lcov-report/favicon.png b/coverage/lcov-report/favicon.png deleted file mode 100644 index c1525b8..0000000 Binary files a/coverage/lcov-report/favicon.png and /dev/null differ diff --git a/coverage/lcov-report/index.html b/coverage/lcov-report/index.html deleted file mode 100644 index 97be080..0000000 --- a/coverage/lcov-report/index.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - Code coverage report for All files - - - - - - - - - -
-
-

All files

-
- -
- 0% - Statements - 0/463 -
- - -
- 0% - Branches - 0/263 -
- - -
- 0% - Functions - 0/61 -
- - -
- 0% - Lines - 0/445 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
content.js -
-
0%0/3710%0/2140%0/440%0/356
popup.js -
-
0%0/920%0/490%0/170%0/89
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/coverage/lcov-report/popup.js.html b/coverage/lcov-report/popup.js.html deleted file mode 100644 index 5f1a6a1..0000000 --- a/coverage/lcov-report/popup.js.html +++ /dev/null @@ -1,643 +0,0 @@ - - - - - - Code coverage report for popup.js - - - - - - - - - -
-
-

All files popup.js

-
- -
- 0% - Statements - 0/92 -
- - -
- 0% - Branches - 0/49 -
- - -
- 0% - Functions - 0/17 -
- - -
- 0% - Lines - 0/89 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 
// Popup script for Chrome extension
-document.addEventListener('DOMContentLoaded', async () => {
-  const backgroundSelect = document.getElementById('background-select');
-  const clipboardToggle = document.getElementById('clipboard-toggle');
-  const startBtn = document.getElementById('start-selector');
-  const stopBtn = document.getElementById('stop-selector');
-  const status = document.getElementById('status');
- 
-  // Load saved preferences
-  const saved = await chrome.storage.sync.get(['backgroundPreference', 'copyToClipboard']);
-  if (saved.backgroundPreference) {
-    backgroundSelect.value = saved.backgroundPreference;
-  }
-  
-  // Set clipboard preference (default to true if not set)
-  clipboardToggle.checked = saved.copyToClipboard !== undefined ? saved.copyToClipboard : true;
- 
-  // Save background preference when changed
-  backgroundSelect.addEventListener('change', () => {
-    chrome.storage.sync.set({ backgroundPreference: backgroundSelect.value });
-  });
- 
-  // Save clipboard preference when changed
-  clipboardToggle.addEventListener('change', () => {
-    chrome.storage.sync.set({ copyToClipboard: clipboardToggle.checked });
-  });
- 
-  // Start selector
-  startBtn.addEventListener('click', async () => {
-    const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
- 
-    // Check if page is compatible
-    if (tab.url.startsWith('chrome://') ||
-        tab.url.startsWith('chrome-extension://') ||
-        tab.url.startsWith('edge://') ||
-        tab.url.startsWith('about:') ||
-        tab.url === 'chrome://newtab/' ||
-        tab.url === 'edge://newtab/') {
-      showStatus('Error: Cannot capture screenshots on this page type.', 'error');
-      return;
-    }
- 
-    try {
-      await chrome.tabs.sendMessage(tab.id, {
-        action: 'startSelector',
-        background: backgroundSelect.value,
-        copyToClipboard: clipboardToggle.checked
-      });
- 
-      showStatus('Selector activated! Hover over elements and click to capture.', 'success');
-      toggleButtons(true);
- 
-      // Auto-close popup after starting
-      setTimeout(() => window.close(), 1500);
- 
-    } catch (error) {
-      console.error('Full error details:', error);
-      if (error.message.includes('Could not establish connection')) {
-        showStatus('Error: Content script not loaded. Try refreshing the page.', 'error');
-      } else {
-        showStatus('Error: Could not activate on this page.', 'error');
-      }
-    }
-  });
- 
-  // Stop selector
-  stopBtn.addEventListener('click', async () => {
-    const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
- 
-    try {
-      await chrome.tabs.sendMessage(tab.id, { action: 'stopSelector' });
-      showStatus('Selector stopped.', 'success');
-      toggleButtons(false);
-    } catch (error) {
-      console.error('Error stopping selector:', error);
-    }
-  });
- 
-  // Check current state
-  checkSelectorState();
- 
-  // Handle tooltip keyboard navigation
-  setupTooltipAccessibility();
- 
-  function toggleButtons(isActive) {
-    if (isActive) {
-      startBtn.style.display = 'none';
-      stopBtn.style.display = 'block';
-    } else {
-      startBtn.style.display = 'block';
-      stopBtn.style.display = 'none';
-    }
-  }
- 
-  function showStatus(message, type = 'success') {
-    status.textContent = message;
-    status.className = `status ${type}`;
-    status.style.display = 'block';
- 
-    setTimeout(() => {
-      status.style.display = 'none';
-    }, 3000);
-  }
- 
-  async function checkSelectorState() {
-    const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
- 
-    // Skip check for incompatible pages
-    if (tab.url.startsWith('chrome://') ||
-        tab.url.startsWith('chrome-extension://') ||
-        tab.url.startsWith('edge://') ||
-        tab.url.startsWith('about:')) {
-      return;
-    }
- 
-    try {
-      const response = await chrome.tabs.sendMessage(tab.id, { action: 'checkState' });
-      if (response && response.isActive) {
-        toggleButtons(true);
-        showStatus('Selector is currently active', 'success');
-      }
-    } catch (error) {
-      // Content script not ready or selector not active
-      console.log('Content script not ready or selector inactive:', error.message);
-    }
-  }
- 
-  function setupTooltipAccessibility() {
-    const tooltipIcon = document.querySelector('.tooltip-icon');
-    const tooltipContent = document.querySelector('.tooltip-content');
-    
-    if (!tooltipIcon || !tooltipContent) return;
- 
-    // Handle keyboard events for tooltip
-    tooltipIcon.addEventListener('keydown', (e) => {
-      if (e.key === 'Enter' || e.key === ' ') {
-        e.preventDefault();
-        // Toggle tooltip visibility on Enter/Space
-        const isVisible = tooltipContent.style.visibility === 'visible';
-        tooltipContent.style.visibility = isVisible ? 'hidden' : 'visible';
-        tooltipContent.style.opacity = isVisible ? '0' : '1';
-      } else if (e.key === 'Escape') {
-        // Hide tooltip on Escape
-        tooltipContent.style.visibility = 'hidden';
-        tooltipContent.style.opacity = '0';
-      }
-    });
- 
-    // Hide tooltip when clicking outside
-    document.addEventListener('click', (e) => {
-      if (!tooltipIcon.contains(e.target)) {
-        tooltipContent.style.visibility = 'hidden';
-        tooltipContent.style.opacity = '0';
-      }
-    });
- 
-    // Handle focus loss
-    tooltipIcon.addEventListener('blur', (e) => {
-      // Small delay to allow for focus to move to tooltip content if needed
-      setTimeout(() => {
-        if (!tooltipIcon.matches(':focus-within')) {
-          tooltipContent.style.visibility = 'hidden';
-          tooltipContent.style.opacity = '0';
-        }
-      }, 100);
-    });
-  }
-});
- 
-// Listen for messages from content script
-chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
-  if (message.action === 'selectorStopped') {
-    const startBtn = document.getElementById('start-selector');
-    const stopBtn = document.getElementById('stop-selector');
-    const status = document.getElementById('status');
- 
-    startBtn.style.display = 'block';
-    stopBtn.style.display = 'none';
- 
-    if (message.reason === 'screenshot-taken') {
-      status.textContent = 'Screenshot captured!';
-      status.className = 'status success';
-      status.style.display = 'block';
-      setTimeout(() => status.style.display = 'none', 2000);
-    }
-  }
-});
- -
-
- - - - - - - - \ No newline at end of file diff --git a/coverage/lcov-report/prettify.css b/coverage/lcov-report/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/coverage/lcov-report/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/coverage/lcov-report/prettify.js b/coverage/lcov-report/prettify.js deleted file mode 100644 index b322523..0000000 --- a/coverage/lcov-report/prettify.js +++ /dev/null @@ -1,2 +0,0 @@ -/* eslint-disable */ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/coverage/lcov-report/sort-arrow-sprite.png b/coverage/lcov-report/sort-arrow-sprite.png deleted file mode 100644 index 6ed6831..0000000 Binary files a/coverage/lcov-report/sort-arrow-sprite.png and /dev/null differ diff --git a/coverage/lcov-report/sorter.js b/coverage/lcov-report/sorter.js deleted file mode 100644 index 2bb296a..0000000 --- a/coverage/lcov-report/sorter.js +++ /dev/null @@ -1,196 +0,0 @@ -/* eslint-disable */ -var addSorting = (function() { - 'use strict'; - var cols, - currentSort = { - index: 0, - desc: false - }; - - // returns the summary table element - function getTable() { - return document.querySelector('.coverage-summary'); - } - // returns the thead element of the summary table - function getTableHeader() { - return getTable().querySelector('thead tr'); - } - // returns the tbody element of the summary table - function getTableBody() { - return getTable().querySelector('tbody'); - } - // returns the th element for nth column - function getNthColumn(n) { - return getTableHeader().querySelectorAll('th')[n]; - } - - function onFilterInput() { - const searchValue = document.getElementById('fileSearch').value; - const rows = document.getElementsByTagName('tbody')[0].children; - for (let i = 0; i < rows.length; i++) { - const row = rows[i]; - if ( - row.textContent - .toLowerCase() - .includes(searchValue.toLowerCase()) - ) { - row.style.display = ''; - } else { - row.style.display = 'none'; - } - } - } - - // loads the search box - function addSearchBox() { - var template = document.getElementById('filterTemplate'); - var templateClone = template.content.cloneNode(true); - templateClone.getElementById('fileSearch').oninput = onFilterInput; - template.parentElement.appendChild(templateClone); - } - - // loads all columns - function loadColumns() { - var colNodes = getTableHeader().querySelectorAll('th'), - colNode, - cols = [], - col, - i; - - for (i = 0; i < colNodes.length; i += 1) { - colNode = colNodes[i]; - col = { - key: colNode.getAttribute('data-col'), - sortable: !colNode.getAttribute('data-nosort'), - type: colNode.getAttribute('data-type') || 'string' - }; - cols.push(col); - if (col.sortable) { - col.defaultDescSort = col.type === 'number'; - colNode.innerHTML = - colNode.innerHTML + ''; - } - } - return cols; - } - // attaches a data attribute to every tr element with an object - // of data values keyed by column name - function loadRowData(tableRow) { - var tableCols = tableRow.querySelectorAll('td'), - colNode, - col, - data = {}, - i, - val; - for (i = 0; i < tableCols.length; i += 1) { - colNode = tableCols[i]; - col = cols[i]; - val = colNode.getAttribute('data-value'); - if (col.type === 'number') { - val = Number(val); - } - data[col.key] = val; - } - return data; - } - // loads all row data - function loadData() { - var rows = getTableBody().querySelectorAll('tr'), - i; - - for (i = 0; i < rows.length; i += 1) { - rows[i].data = loadRowData(rows[i]); - } - } - // sorts the table using the data for the ith column - function sortByIndex(index, desc) { - var key = cols[index].key, - sorter = function(a, b) { - a = a.data[key]; - b = b.data[key]; - return a < b ? -1 : a > b ? 1 : 0; - }, - finalSorter = sorter, - tableBody = document.querySelector('.coverage-summary tbody'), - rowNodes = tableBody.querySelectorAll('tr'), - rows = [], - i; - - if (desc) { - finalSorter = function(a, b) { - return -1 * sorter(a, b); - }; - } - - for (i = 0; i < rowNodes.length; i += 1) { - rows.push(rowNodes[i]); - tableBody.removeChild(rowNodes[i]); - } - - rows.sort(finalSorter); - - for (i = 0; i < rows.length; i += 1) { - tableBody.appendChild(rows[i]); - } - } - // removes sort indicators for current column being sorted - function removeSortIndicators() { - var col = getNthColumn(currentSort.index), - cls = col.className; - - cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); - col.className = cls; - } - // adds sort indicators for current column being sorted - function addSortIndicators() { - getNthColumn(currentSort.index).className += currentSort.desc - ? ' sorted-desc' - : ' sorted'; - } - // adds event listeners for all sorter widgets - function enableUI() { - var i, - el, - ithSorter = function ithSorter(i) { - var col = cols[i]; - - return function() { - var desc = col.defaultDescSort; - - if (currentSort.index === i) { - desc = !currentSort.desc; - } - sortByIndex(i, desc); - removeSortIndicators(); - currentSort.index = i; - currentSort.desc = desc; - addSortIndicators(); - }; - }; - for (i = 0; i < cols.length; i += 1) { - if (cols[i].sortable) { - // add the click event handler on the th so users - // dont have to click on those tiny arrows - el = getNthColumn(i).querySelector('.sorter').parentElement; - if (el.addEventListener) { - el.addEventListener('click', ithSorter(i)); - } else { - el.attachEvent('onclick', ithSorter(i)); - } - } - } - } - // adds sorting functionality to the UI - return function() { - if (!getTable()) { - return; - } - cols = loadColumns(); - loadData(); - addSearchBox(); - addSortIndicators(); - enableUI(); - }; -})(); - -window.addEventListener('load', addSorting); diff --git a/coverage/lcov.info b/coverage/lcov.info deleted file mode 100644 index 374cf82..0000000 --- a/coverage/lcov.info +++ /dev/null @@ -1,848 +0,0 @@ -TN: -SF:content.js -FN:3,(anonymous_0) -FN:12,(anonymous_1) -FN:26,(anonymous_2) -FN:76,(anonymous_3) -FN:79,(anonymous_4) -FN:89,(anonymous_5) -FN:105,(anonymous_6) -FN:114,(anonymous_7) -FN:120,(anonymous_8) -FN:176,(anonymous_9) -FN:178,(anonymous_10) -FN:182,(anonymous_11) -FN:184,(anonymous_12) -FN:201,(anonymous_13) -FN:215,(anonymous_14) -FN:249,(anonymous_15) -FN:273,(anonymous_16) -FN:275,(anonymous_17) -FN:291,(anonymous_18) -FN:311,(anonymous_19) -FN:332,(anonymous_20) -FN:336,(anonymous_21) -FN:346,(anonymous_22) -FN:347,(anonymous_23) -FN:361,(anonymous_24) -FN:366,(anonymous_25) -FN:435,(anonymous_26) -FN:441,(anonymous_27) -FN:455,(anonymous_28) -FN:544,(anonymous_29) -FN:578,(anonymous_30) -FN:586,(anonymous_31) -FN:628,(anonymous_32) -FN:662,(anonymous_33) -FN:728,(anonymous_34) -FN:742,(anonymous_35) -FN:743,(anonymous_36) -FN:751,(anonymous_37) -FN:752,(anonymous_38) -FN:783,(anonymous_39) -FN:784,(anonymous_40) -FN:856,(anonymous_41) -FN:890,(anonymous_42) -FN:931,(anonymous_43) -FNF:44 -FNH:0 -FNDA:0,(anonymous_0) -FNDA:0,(anonymous_1) -FNDA:0,(anonymous_2) -FNDA:0,(anonymous_3) -FNDA:0,(anonymous_4) -FNDA:0,(anonymous_5) -FNDA:0,(anonymous_6) -FNDA:0,(anonymous_7) -FNDA:0,(anonymous_8) -FNDA:0,(anonymous_9) -FNDA:0,(anonymous_10) -FNDA:0,(anonymous_11) -FNDA:0,(anonymous_12) -FNDA:0,(anonymous_13) -FNDA:0,(anonymous_14) -FNDA:0,(anonymous_15) -FNDA:0,(anonymous_16) -FNDA:0,(anonymous_17) -FNDA:0,(anonymous_18) -FNDA:0,(anonymous_19) -FNDA:0,(anonymous_20) -FNDA:0,(anonymous_21) -FNDA:0,(anonymous_22) -FNDA:0,(anonymous_23) -FNDA:0,(anonymous_24) -FNDA:0,(anonymous_25) -FNDA:0,(anonymous_26) -FNDA:0,(anonymous_27) -FNDA:0,(anonymous_28) -FNDA:0,(anonymous_29) -FNDA:0,(anonymous_30) -FNDA:0,(anonymous_31) -FNDA:0,(anonymous_32) -FNDA:0,(anonymous_33) -FNDA:0,(anonymous_34) -FNDA:0,(anonymous_35) -FNDA:0,(anonymous_36) -FNDA:0,(anonymous_37) -FNDA:0,(anonymous_38) -FNDA:0,(anonymous_39) -FNDA:0,(anonymous_40) -FNDA:0,(anonymous_41) -FNDA:0,(anonymous_42) -FNDA:0,(anonymous_43) -DA:4,0 -DA:5,0 -DA:6,0 -DA:7,0 -DA:8,0 -DA:9,0 -DA:13,0 -DA:14,0 -DA:15,0 -DA:18,0 -DA:19,0 -DA:20,0 -DA:22,0 -DA:23,0 -DA:28,0 -DA:29,0 -DA:30,0 -DA:41,0 -DA:42,0 -DA:72,0 -DA:73,0 -DA:76,0 -DA:80,0 -DA:81,0 -DA:82,0 -DA:84,0 -DA:85,0 -DA:86,0 -DA:90,0 -DA:93,0 -DA:94,0 -DA:95,0 -DA:98,0 -DA:99,0 -DA:102,0 -DA:106,0 -DA:107,0 -DA:108,0 -DA:110,0 -DA:111,0 -DA:115,0 -DA:116,0 -DA:121,0 -DA:122,0 -DA:123,0 -DA:125,0 -DA:128,0 -DA:129,0 -DA:130,0 -DA:131,0 -DA:134,0 -DA:135,0 -DA:136,0 -DA:137,0 -DA:140,0 -DA:147,0 -DA:148,0 -DA:151,0 -DA:152,0 -DA:153,0 -DA:167,0 -DA:168,0 -DA:169,0 -DA:170,0 -DA:172,0 -DA:177,0 -DA:178,0 -DA:184,0 -DA:185,0 -DA:186,0 -DA:187,0 -DA:191,0 -DA:194,0 -DA:195,0 -DA:198,0 -DA:199,0 -DA:201,0 -DA:203,0 -DA:204,0 -DA:209,0 -DA:210,0 -DA:211,0 -DA:216,0 -DA:218,0 -DA:221,0 -DA:249,0 -DA:250,0 -DA:251,0 -DA:252,0 -DA:253,0 -DA:261,0 -DA:264,0 -DA:265,0 -DA:267,0 -DA:268,0 -DA:274,0 -DA:275,0 -DA:276,0 -DA:277,0 -DA:280,0 -DA:281,0 -DA:289,0 -DA:290,0 -DA:291,0 -DA:292,0 -DA:293,0 -DA:294,0 -DA:297,0 -DA:300,0 -DA:301,0 -DA:302,0 -DA:313,0 -DA:314,0 -DA:315,0 -DA:322,0 -DA:329,0 -DA:330,0 -DA:332,0 -DA:333,0 -DA:334,0 -DA:336,0 -DA:337,0 -DA:339,0 -DA:340,0 -DA:341,0 -DA:342,0 -DA:343,0 -DA:344,0 -DA:346,0 -DA:347,0 -DA:348,0 -DA:349,0 -DA:352,0 -DA:358,0 -DA:361,0 -DA:367,0 -DA:369,0 -DA:370,0 -DA:371,0 -DA:372,0 -DA:373,0 -DA:375,0 -DA:380,0 -DA:396,0 -DA:397,0 -DA:400,0 -DA:411,0 -DA:412,0 -DA:413,0 -DA:414,0 -DA:415,0 -DA:418,0 -DA:421,0 -DA:437,0 -DA:438,0 -DA:441,0 -DA:442,0 -DA:443,0 -DA:445,0 -DA:446,0 -DA:447,0 -DA:448,0 -DA:449,0 -DA:450,0 -DA:452,0 -DA:453,0 -DA:454,0 -DA:455,0 -DA:456,0 -DA:459,0 -DA:461,0 -DA:465,0 -DA:470,0 -DA:471,0 -DA:472,0 -DA:473,0 -DA:476,0 -DA:481,0 -DA:484,0 -DA:485,0 -DA:486,0 -DA:487,0 -DA:490,0 -DA:491,0 -DA:492,0 -DA:493,0 -DA:494,0 -DA:496,0 -DA:500,0 -DA:501,0 -DA:508,0 -DA:517,0 -DA:518,0 -DA:520,0 -DA:521,0 -DA:522,0 -DA:526,0 -DA:527,0 -DA:528,0 -DA:532,0 -DA:542,0 -DA:544,0 -DA:547,0 -DA:550,0 -DA:552,0 -DA:553,0 -DA:554,0 -DA:555,0 -DA:556,0 -DA:557,0 -DA:558,0 -DA:559,0 -DA:560,0 -DA:561,0 -DA:562,0 -DA:566,0 -DA:576,0 -DA:578,0 -DA:588,0 -DA:589,0 -DA:596,0 -DA:597,0 -DA:604,0 -DA:605,0 -DA:612,0 -DA:613,0 -DA:619,0 -DA:629,0 -DA:631,0 -DA:632,0 -DA:639,0 -DA:641,0 -DA:642,0 -DA:643,0 -DA:644,0 -DA:645,0 -DA:646,0 -DA:648,0 -DA:651,0 -DA:663,0 -DA:664,0 -DA:667,0 -DA:668,0 -DA:671,0 -DA:673,0 -DA:677,0 -DA:680,0 -DA:684,0 -DA:687,0 -DA:690,0 -DA:693,0 -DA:696,0 -DA:699,0 -DA:702,0 -DA:705,0 -DA:709,0 -DA:710,0 -DA:711,0 -DA:712,0 -DA:713,0 -DA:714,0 -DA:715,0 -DA:716,0 -DA:718,0 -DA:729,0 -DA:731,0 -DA:732,0 -DA:733,0 -DA:741,0 -DA:743,0 -DA:744,0 -DA:745,0 -DA:747,0 -DA:752,0 -DA:757,0 -DA:758,0 -DA:759,0 -DA:768,0 -DA:769,0 -DA:773,0 -DA:781,0 -DA:784,0 -DA:788,0 -DA:791,0 -DA:794,0 -DA:795,0 -DA:798,0 -DA:799,0 -DA:800,0 -DA:803,0 -DA:804,0 -DA:805,0 -DA:808,0 -DA:809,0 -DA:810,0 -DA:813,0 -DA:814,0 -DA:815,0 -DA:818,0 -DA:819,0 -DA:820,0 -DA:823,0 -DA:824,0 -DA:825,0 -DA:828,0 -DA:829,0 -DA:830,0 -DA:833,0 -DA:834,0 -DA:835,0 -DA:838,0 -DA:839,0 -DA:840,0 -DA:844,0 -DA:845,0 -DA:848,0 -DA:857,0 -DA:858,0 -DA:859,0 -DA:861,0 -DA:862,0 -DA:866,0 -DA:868,0 -DA:869,0 -DA:870,0 -DA:873,0 -DA:874,0 -DA:875,0 -DA:878,0 -DA:879,0 -DA:884,0 -DA:887,0 -DA:890,0 -DA:891,0 -DA:892,0 -DA:895,0 -DA:896,0 -DA:897,0 -DA:898,0 -DA:901,0 -DA:902,0 -DA:903,0 -DA:906,0 -DA:907,0 -DA:910,0 -DA:911,0 -DA:912,0 -DA:916,0 -DA:919,0 -DA:922,0 -DA:923,0 -DA:927,0 -DA:931,0 -DA:932,0 -DA:933,0 -DA:934,0 -LF:356 -LH:0 -BRDA:12,0,0,0 -BRDA:12,1,0,0 -BRDA:13,2,0,0 -BRDA:13,2,1,0 -BRDA:90,3,0,0 -BRDA:90,3,1,0 -BRDA:93,4,0,0 -BRDA:93,4,1,0 -BRDA:106,5,0,0 -BRDA:106,5,1,0 -BRDA:115,6,0,0 -BRDA:115,6,1,0 -BRDA:125,7,0,0 -BRDA:125,7,1,0 -BRDA:125,8,0,0 -BRDA:125,8,1,0 -BRDA:134,9,0,0 -BRDA:134,9,1,0 -BRDA:134,10,0,0 -BRDA:134,10,1,0 -BRDA:143,11,0,0 -BRDA:143,11,1,0 -BRDA:144,12,0,0 -BRDA:144,12,1,0 -BRDA:168,13,0,0 -BRDA:168,13,1,0 -BRDA:169,14,0,0 -BRDA:169,14,1,0 -BRDA:186,15,0,0 -BRDA:186,15,1,0 -BRDA:186,16,0,0 -BRDA:186,16,1,0 -BRDA:194,17,0,0 -BRDA:194,17,1,0 -BRDA:198,18,0,0 -BRDA:198,18,1,0 -BRDA:198,19,0,0 -BRDA:198,19,1,0 -BRDA:203,20,0,0 -BRDA:203,20,1,0 -BRDA:209,21,0,0 -BRDA:209,21,1,0 -BRDA:216,22,0,0 -BRDA:216,22,1,0 -BRDA:216,23,0,0 -BRDA:216,23,1,0 -BRDA:251,24,0,0 -BRDA:251,24,1,0 -BRDA:251,25,0,0 -BRDA:251,25,1,0 -BRDA:251,25,2,0 -BRDA:251,25,3,0 -BRDA:251,25,4,0 -BRDA:280,26,0,0 -BRDA:280,26,1,0 -BRDA:280,27,0,0 -BRDA:280,27,1,0 -BRDA:280,27,2,0 -BRDA:293,28,0,0 -BRDA:293,28,1,0 -BRDA:293,29,0,0 -BRDA:293,29,1,0 -BRDA:293,29,2,0 -BRDA:313,30,0,0 -BRDA:313,30,1,0 -BRDA:313,31,0,0 -BRDA:313,31,1,0 -BRDA:337,32,0,0 -BRDA:337,32,1,0 -BRDA:370,33,0,0 -BRDA:370,33,1,0 -BRDA:372,34,0,0 -BRDA:372,34,1,0 -BRDA:424,35,0,0 -BRDA:424,35,1,0 -BRDA:425,36,0,0 -BRDA:425,36,1,0 -BRDA:428,37,0,0 -BRDA:428,37,1,0 -BRDA:443,38,0,0 -BRDA:443,38,1,0 -BRDA:450,39,0,0 -BRDA:450,39,1,0 -BRDA:450,40,0,0 -BRDA:450,40,1,0 -BRDA:472,41,0,0 -BRDA:472,41,1,0 -BRDA:472,42,0,0 -BRDA:472,42,1,0 -BRDA:491,43,0,0 -BRDA:491,43,1,0 -BRDA:493,44,0,0 -BRDA:493,44,1,0 -BRDA:520,45,0,0 -BRDA:520,45,1,0 -BRDA:521,46,0,0 -BRDA:521,46,1,0 -BRDA:521,47,0,0 -BRDA:521,47,1,0 -BRDA:552,48,0,0 -BRDA:552,48,1,0 -BRDA:553,49,0,0 -BRDA:553,49,1,0 -BRDA:555,50,0,0 -BRDA:555,50,1,0 -BRDA:557,51,0,0 -BRDA:557,51,1,0 -BRDA:557,52,0,0 -BRDA:557,52,1,0 -BRDA:559,53,0,0 -BRDA:559,53,1,0 -BRDA:559,54,0,0 -BRDA:559,54,1,0 -BRDA:561,55,0,0 -BRDA:561,55,1,0 -BRDA:588,56,0,0 -BRDA:588,56,1,0 -BRDA:596,57,0,0 -BRDA:596,57,1,0 -BRDA:604,58,0,0 -BRDA:604,58,1,0 -BRDA:612,59,0,0 -BRDA:612,59,1,0 -BRDA:631,60,0,0 -BRDA:631,60,1,0 -BRDA:641,61,0,0 -BRDA:641,61,1,0 -BRDA:641,62,0,0 -BRDA:641,62,1,0 -BRDA:643,63,0,0 -BRDA:643,63,1,0 -BRDA:645,64,0,0 -BRDA:645,64,1,0 -BRDA:663,65,0,0 -BRDA:663,65,1,0 -BRDA:663,66,0,0 -BRDA:663,66,1,0 -BRDA:671,67,0,0 -BRDA:671,67,1,0 -BRDA:671,67,2,0 -BRDA:671,67,3,0 -BRDA:671,67,4,0 -BRDA:671,67,5,0 -BRDA:671,67,6,0 -BRDA:671,67,7,0 -BRDA:671,67,8,0 -BRDA:671,67,9,0 -BRDA:671,67,10,0 -BRDA:671,67,11,0 -BRDA:671,67,12,0 -BRDA:671,67,13,0 -BRDA:709,68,0,0 -BRDA:709,68,1,0 -BRDA:709,69,0,0 -BRDA:709,69,1,0 -BRDA:711,70,0,0 -BRDA:711,70,1,0 -BRDA:711,71,0,0 -BRDA:711,71,1,0 -BRDA:713,72,0,0 -BRDA:713,72,1,0 -BRDA:713,73,0,0 -BRDA:713,73,1,0 -BRDA:715,74,0,0 -BRDA:715,74,1,0 -BRDA:715,75,0,0 -BRDA:715,75,1,0 -BRDA:732,76,0,0 -BRDA:732,76,1,0 -BRDA:744,77,0,0 -BRDA:744,77,1,0 -BRDA:758,78,0,0 -BRDA:758,78,1,0 -BRDA:794,79,0,0 -BRDA:794,79,1,0 -BRDA:798,80,0,0 -BRDA:798,80,1,0 -BRDA:803,81,0,0 -BRDA:803,81,1,0 -BRDA:808,82,0,0 -BRDA:808,82,1,0 -BRDA:813,83,0,0 -BRDA:813,83,1,0 -BRDA:818,84,0,0 -BRDA:818,84,1,0 -BRDA:823,85,0,0 -BRDA:823,85,1,0 -BRDA:823,86,0,0 -BRDA:823,86,1,0 -BRDA:828,87,0,0 -BRDA:828,87,1,0 -BRDA:828,88,0,0 -BRDA:828,88,1,0 -BRDA:833,89,0,0 -BRDA:833,89,1,0 -BRDA:838,90,0,0 -BRDA:838,90,1,0 -BRDA:861,91,0,0 -BRDA:861,91,1,0 -BRDA:868,92,0,0 -BRDA:868,92,1,0 -BRDA:873,93,0,0 -BRDA:873,93,1,0 -BRDA:892,94,0,0 -BRDA:892,94,1,0 -BRDA:892,94,2,0 -BRDA:892,94,3,0 -BRDA:892,94,4,0 -BRDA:895,95,0,0 -BRDA:895,95,1,0 -BRDA:932,96,0,0 -BRDA:932,96,1,0 -BRDA:933,97,0,0 -BRDA:933,97,1,0 -BRF:214 -BRH:0 -end_of_record -TN: -SF:popup.js -FN:2,(anonymous_0) -FN:19,(anonymous_1) -FN:24,(anonymous_2) -FN:29,(anonymous_3) -FN:54,(anonymous_4) -FN:67,(anonymous_5) -FN:85,toggleButtons -FN:95,showStatus -FN:100,(anonymous_8) -FN:105,checkSelectorState -FN:128,setupTooltipAccessibility -FN:135,(anonymous_11) -FN:150,(anonymous_12) -FN:158,(anonymous_13) -FN:160,(anonymous_14) -FN:171,(anonymous_15) -FN:184,(anonymous_16) -FNF:17 -FNH:0 -FNDA:0,(anonymous_0) -FNDA:0,(anonymous_1) -FNDA:0,(anonymous_2) -FNDA:0,(anonymous_3) -FNDA:0,(anonymous_4) -FNDA:0,(anonymous_5) -FNDA:0,toggleButtons -FNDA:0,showStatus -FNDA:0,(anonymous_8) -FNDA:0,checkSelectorState -FNDA:0,setupTooltipAccessibility -FNDA:0,(anonymous_11) -FNDA:0,(anonymous_12) -FNDA:0,(anonymous_13) -FNDA:0,(anonymous_14) -FNDA:0,(anonymous_15) -FNDA:0,(anonymous_16) -DA:2,0 -DA:3,0 -DA:4,0 -DA:5,0 -DA:6,0 -DA:7,0 -DA:10,0 -DA:11,0 -DA:12,0 -DA:16,0 -DA:19,0 -DA:20,0 -DA:24,0 -DA:25,0 -DA:29,0 -DA:30,0 -DA:33,0 -DA:39,0 -DA:40,0 -DA:43,0 -DA:44,0 -DA:50,0 -DA:51,0 -DA:54,0 -DA:57,0 -DA:58,0 -DA:59,0 -DA:61,0 -DA:67,0 -DA:68,0 -DA:70,0 -DA:71,0 -DA:72,0 -DA:73,0 -DA:75,0 -DA:80,0 -DA:83,0 -DA:86,0 -DA:87,0 -DA:88,0 -DA:90,0 -DA:91,0 -DA:96,0 -DA:97,0 -DA:98,0 -DA:100,0 -DA:101,0 -DA:106,0 -DA:109,0 -DA:113,0 -DA:116,0 -DA:117,0 -DA:118,0 -DA:119,0 -DA:120,0 -DA:124,0 -DA:129,0 -DA:130,0 -DA:132,0 -DA:135,0 -DA:136,0 -DA:137,0 -DA:139,0 -DA:140,0 -DA:141,0 -DA:142,0 -DA:144,0 -DA:145,0 -DA:150,0 -DA:151,0 -DA:152,0 -DA:153,0 -DA:158,0 -DA:160,0 -DA:161,0 -DA:162,0 -DA:163,0 -DA:171,0 -DA:172,0 -DA:173,0 -DA:174,0 -DA:175,0 -DA:177,0 -DA:178,0 -DA:180,0 -DA:181,0 -DA:182,0 -DA:183,0 -DA:184,0 -LF:89 -LH:0 -BRDA:11,0,0,0 -BRDA:11,0,1,0 -BRDA:16,1,0,0 -BRDA:16,1,1,0 -BRDA:33,2,0,0 -BRDA:33,2,1,0 -BRDA:33,3,0,0 -BRDA:33,3,1,0 -BRDA:33,3,2,0 -BRDA:33,3,3,0 -BRDA:33,3,4,0 -BRDA:33,3,5,0 -BRDA:58,4,0,0 -BRDA:58,4,1,0 -BRDA:86,5,0,0 -BRDA:86,5,1,0 -BRDA:95,6,0,0 -BRDA:109,7,0,0 -BRDA:109,7,1,0 -BRDA:109,8,0,0 -BRDA:109,8,1,0 -BRDA:109,8,2,0 -BRDA:109,8,3,0 -BRDA:118,9,0,0 -BRDA:118,9,1,0 -BRDA:118,10,0,0 -BRDA:118,10,1,0 -BRDA:132,11,0,0 -BRDA:132,11,1,0 -BRDA:132,12,0,0 -BRDA:132,12,1,0 -BRDA:136,13,0,0 -BRDA:136,13,1,0 -BRDA:136,14,0,0 -BRDA:136,14,1,0 -BRDA:140,15,0,0 -BRDA:140,15,1,0 -BRDA:141,16,0,0 -BRDA:141,16,1,0 -BRDA:142,17,0,0 -BRDA:142,17,1,0 -BRDA:151,18,0,0 -BRDA:151,18,1,0 -BRDA:161,19,0,0 -BRDA:161,19,1,0 -BRDA:172,20,0,0 -BRDA:172,20,1,0 -BRDA:180,21,0,0 -BRDA:180,21,1,0 -BRF:49 -BRH:0 -end_of_record diff --git a/coverage/popup.js.html b/coverage/popup.js.html deleted file mode 100644 index c932cc4..0000000 --- a/coverage/popup.js.html +++ /dev/null @@ -1,643 +0,0 @@ - - - - - - Code coverage report for popup.js - - - - - - - - - -
-
-

All files popup.js

-
- -
- 0% - Statements - 0/92 -
- - -
- 0% - Branches - 0/49 -
- - -
- 0% - Functions - 0/17 -
- - -
- 0% - Lines - 0/89 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 
// Popup script for Chrome extension
-document.addEventListener('DOMContentLoaded', async () => {
-  const backgroundSelect = document.getElementById('background-select');
-  const clipboardToggle = document.getElementById('clipboard-toggle');
-  const startBtn = document.getElementById('start-selector');
-  const stopBtn = document.getElementById('stop-selector');
-  const status = document.getElementById('status');
- 
-  // Load saved preferences
-  const saved = await chrome.storage.sync.get(['backgroundPreference', 'copyToClipboard']);
-  if (saved.backgroundPreference) {
-    backgroundSelect.value = saved.backgroundPreference;
-  }
-  
-  // Set clipboard preference (default to true if not set)
-  clipboardToggle.checked = saved.copyToClipboard !== undefined ? saved.copyToClipboard : true;
- 
-  // Save background preference when changed
-  backgroundSelect.addEventListener('change', () => {
-    chrome.storage.sync.set({ backgroundPreference: backgroundSelect.value });
-  });
- 
-  // Save clipboard preference when changed
-  clipboardToggle.addEventListener('change', () => {
-    chrome.storage.sync.set({ copyToClipboard: clipboardToggle.checked });
-  });
- 
-  // Start selector
-  startBtn.addEventListener('click', async () => {
-    const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
- 
-    // Check if page is compatible
-    if (tab.url.startsWith('chrome://') ||
-        tab.url.startsWith('chrome-extension://') ||
-        tab.url.startsWith('edge://') ||
-        tab.url.startsWith('about:') ||
-        tab.url === 'chrome://newtab/' ||
-        tab.url === 'edge://newtab/') {
-      showStatus('Error: Cannot capture screenshots on this page type.', 'error');
-      return;
-    }
- 
-    try {
-      await chrome.tabs.sendMessage(tab.id, {
-        action: 'startSelector',
-        background: backgroundSelect.value,
-        copyToClipboard: clipboardToggle.checked
-      });
- 
-      showStatus('Selector activated! Hover over elements and click to capture.', 'success');
-      toggleButtons(true);
- 
-      // Auto-close popup after starting
-      setTimeout(() => window.close(), 1500);
- 
-    } catch (error) {
-      console.error('Full error details:', error);
-      if (error.message.includes('Could not establish connection')) {
-        showStatus('Error: Content script not loaded. Try refreshing the page.', 'error');
-      } else {
-        showStatus('Error: Could not activate on this page.', 'error');
-      }
-    }
-  });
- 
-  // Stop selector
-  stopBtn.addEventListener('click', async () => {
-    const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
- 
-    try {
-      await chrome.tabs.sendMessage(tab.id, { action: 'stopSelector' });
-      showStatus('Selector stopped.', 'success');
-      toggleButtons(false);
-    } catch (error) {
-      console.error('Error stopping selector:', error);
-    }
-  });
- 
-  // Check current state
-  checkSelectorState();
- 
-  // Handle tooltip keyboard navigation
-  setupTooltipAccessibility();
- 
-  function toggleButtons(isActive) {
-    if (isActive) {
-      startBtn.style.display = 'none';
-      stopBtn.style.display = 'block';
-    } else {
-      startBtn.style.display = 'block';
-      stopBtn.style.display = 'none';
-    }
-  }
- 
-  function showStatus(message, type = 'success') {
-    status.textContent = message;
-    status.className = `status ${type}`;
-    status.style.display = 'block';
- 
-    setTimeout(() => {
-      status.style.display = 'none';
-    }, 3000);
-  }
- 
-  async function checkSelectorState() {
-    const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
- 
-    // Skip check for incompatible pages
-    if (tab.url.startsWith('chrome://') ||
-        tab.url.startsWith('chrome-extension://') ||
-        tab.url.startsWith('edge://') ||
-        tab.url.startsWith('about:')) {
-      return;
-    }
- 
-    try {
-      const response = await chrome.tabs.sendMessage(tab.id, { action: 'checkState' });
-      if (response && response.isActive) {
-        toggleButtons(true);
-        showStatus('Selector is currently active', 'success');
-      }
-    } catch (error) {
-      // Content script not ready or selector not active
-      console.log('Content script not ready or selector inactive:', error.message);
-    }
-  }
- 
-  function setupTooltipAccessibility() {
-    const tooltipIcon = document.querySelector('.tooltip-icon');
-    const tooltipContent = document.querySelector('.tooltip-content');
-    
-    if (!tooltipIcon || !tooltipContent) return;
- 
-    // Handle keyboard events for tooltip
-    tooltipIcon.addEventListener('keydown', (e) => {
-      if (e.key === 'Enter' || e.key === ' ') {
-        e.preventDefault();
-        // Toggle tooltip visibility on Enter/Space
-        const isVisible = tooltipContent.style.visibility === 'visible';
-        tooltipContent.style.visibility = isVisible ? 'hidden' : 'visible';
-        tooltipContent.style.opacity = isVisible ? '0' : '1';
-      } else if (e.key === 'Escape') {
-        // Hide tooltip on Escape
-        tooltipContent.style.visibility = 'hidden';
-        tooltipContent.style.opacity = '0';
-      }
-    });
- 
-    // Hide tooltip when clicking outside
-    document.addEventListener('click', (e) => {
-      if (!tooltipIcon.contains(e.target)) {
-        tooltipContent.style.visibility = 'hidden';
-        tooltipContent.style.opacity = '0';
-      }
-    });
- 
-    // Handle focus loss
-    tooltipIcon.addEventListener('blur', (e) => {
-      // Small delay to allow for focus to move to tooltip content if needed
-      setTimeout(() => {
-        if (!tooltipIcon.matches(':focus-within')) {
-          tooltipContent.style.visibility = 'hidden';
-          tooltipContent.style.opacity = '0';
-        }
-      }, 100);
-    });
-  }
-});
- 
-// Listen for messages from content script
-chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
-  if (message.action === 'selectorStopped') {
-    const startBtn = document.getElementById('start-selector');
-    const stopBtn = document.getElementById('stop-selector');
-    const status = document.getElementById('status');
- 
-    startBtn.style.display = 'block';
-    stopBtn.style.display = 'none';
- 
-    if (message.reason === 'screenshot-taken') {
-      status.textContent = 'Screenshot captured!';
-      status.className = 'status success';
-      status.style.display = 'block';
-      setTimeout(() => status.style.display = 'none', 2000);
-    }
-  }
-});
- -
-
- - - - - - - - \ No newline at end of file diff --git a/coverage/prettify.css b/coverage/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/coverage/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/coverage/prettify.js b/coverage/prettify.js deleted file mode 100644 index b322523..0000000 --- a/coverage/prettify.js +++ /dev/null @@ -1,2 +0,0 @@ -/* eslint-disable */ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/coverage/sort-arrow-sprite.png b/coverage/sort-arrow-sprite.png deleted file mode 100644 index 6ed6831..0000000 Binary files a/coverage/sort-arrow-sprite.png and /dev/null differ diff --git a/coverage/sorter.js b/coverage/sorter.js deleted file mode 100644 index 2bb296a..0000000 --- a/coverage/sorter.js +++ /dev/null @@ -1,196 +0,0 @@ -/* eslint-disable */ -var addSorting = (function() { - 'use strict'; - var cols, - currentSort = { - index: 0, - desc: false - }; - - // returns the summary table element - function getTable() { - return document.querySelector('.coverage-summary'); - } - // returns the thead element of the summary table - function getTableHeader() { - return getTable().querySelector('thead tr'); - } - // returns the tbody element of the summary table - function getTableBody() { - return getTable().querySelector('tbody'); - } - // returns the th element for nth column - function getNthColumn(n) { - return getTableHeader().querySelectorAll('th')[n]; - } - - function onFilterInput() { - const searchValue = document.getElementById('fileSearch').value; - const rows = document.getElementsByTagName('tbody')[0].children; - for (let i = 0; i < rows.length; i++) { - const row = rows[i]; - if ( - row.textContent - .toLowerCase() - .includes(searchValue.toLowerCase()) - ) { - row.style.display = ''; - } else { - row.style.display = 'none'; - } - } - } - - // loads the search box - function addSearchBox() { - var template = document.getElementById('filterTemplate'); - var templateClone = template.content.cloneNode(true); - templateClone.getElementById('fileSearch').oninput = onFilterInput; - template.parentElement.appendChild(templateClone); - } - - // loads all columns - function loadColumns() { - var colNodes = getTableHeader().querySelectorAll('th'), - colNode, - cols = [], - col, - i; - - for (i = 0; i < colNodes.length; i += 1) { - colNode = colNodes[i]; - col = { - key: colNode.getAttribute('data-col'), - sortable: !colNode.getAttribute('data-nosort'), - type: colNode.getAttribute('data-type') || 'string' - }; - cols.push(col); - if (col.sortable) { - col.defaultDescSort = col.type === 'number'; - colNode.innerHTML = - colNode.innerHTML + ''; - } - } - return cols; - } - // attaches a data attribute to every tr element with an object - // of data values keyed by column name - function loadRowData(tableRow) { - var tableCols = tableRow.querySelectorAll('td'), - colNode, - col, - data = {}, - i, - val; - for (i = 0; i < tableCols.length; i += 1) { - colNode = tableCols[i]; - col = cols[i]; - val = colNode.getAttribute('data-value'); - if (col.type === 'number') { - val = Number(val); - } - data[col.key] = val; - } - return data; - } - // loads all row data - function loadData() { - var rows = getTableBody().querySelectorAll('tr'), - i; - - for (i = 0; i < rows.length; i += 1) { - rows[i].data = loadRowData(rows[i]); - } - } - // sorts the table using the data for the ith column - function sortByIndex(index, desc) { - var key = cols[index].key, - sorter = function(a, b) { - a = a.data[key]; - b = b.data[key]; - return a < b ? -1 : a > b ? 1 : 0; - }, - finalSorter = sorter, - tableBody = document.querySelector('.coverage-summary tbody'), - rowNodes = tableBody.querySelectorAll('tr'), - rows = [], - i; - - if (desc) { - finalSorter = function(a, b) { - return -1 * sorter(a, b); - }; - } - - for (i = 0; i < rowNodes.length; i += 1) { - rows.push(rowNodes[i]); - tableBody.removeChild(rowNodes[i]); - } - - rows.sort(finalSorter); - - for (i = 0; i < rows.length; i += 1) { - tableBody.appendChild(rows[i]); - } - } - // removes sort indicators for current column being sorted - function removeSortIndicators() { - var col = getNthColumn(currentSort.index), - cls = col.className; - - cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); - col.className = cls; - } - // adds sort indicators for current column being sorted - function addSortIndicators() { - getNthColumn(currentSort.index).className += currentSort.desc - ? ' sorted-desc' - : ' sorted'; - } - // adds event listeners for all sorter widgets - function enableUI() { - var i, - el, - ithSorter = function ithSorter(i) { - var col = cols[i]; - - return function() { - var desc = col.defaultDescSort; - - if (currentSort.index === i) { - desc = !currentSort.desc; - } - sortByIndex(i, desc); - removeSortIndicators(); - currentSort.index = i; - currentSort.desc = desc; - addSortIndicators(); - }; - }; - for (i = 0; i < cols.length; i += 1) { - if (cols[i].sortable) { - // add the click event handler on the th so users - // dont have to click on those tiny arrows - el = getNthColumn(i).querySelector('.sorter').parentElement; - if (el.addEventListener) { - el.addEventListener('click', ithSorter(i)); - } else { - el.attachEvent('onclick', ithSorter(i)); - } - } - } - } - // adds sorting functionality to the UI - return function() { - if (!getTable()) { - return; - } - cols = loadColumns(); - loadData(); - addSearchBox(); - addSortIndicators(); - enableUI(); - }; -})(); - -window.addEventListener('load', addSorting);