Members
clear_all_btn
Clears all the elements in clipboard This function clears the clipboard list displayed in the extention and the chrome storage
Input
- This function is executed when the user clicks on Clear all button
Output
- the chrome storage is cleared
- All the copied text is removed from the user interface.
sb
Reading the search string This function reads the text entered in the search bar
Input
- This function is executed when the user inputs any data in the search bar
Output
- sets the search_str as the data entered in the search bar
- The flag is set to 1 if any data is entered in the search bar
Methods
(async) addClipboardList()
- Source:
Adds content to cliboard list. Should not be used directly, instead use readClipboardText.
Input
- Content copied by user, text only
Output
- None
- Text is added to the clipboard list if conditions are met
addClipboardListItem()
Adds copied items to UI
Input
- text, The copied text
Output
- New element is added to UI containing new copied text
convertContentForClipboard()
For image links, converts them to raw image data before copying to clipboard New data types should also be added here
Input
- content, The image link to be converted
Output
- Converted image is added to the clipboard
createButtonListeners()
Adds event listeners to the toggle extension, toggle theme, and save file buttons
Input
- None
Output
- 3 event listeners
download()
Automates download of clipboard list as a csv file Credit goes to DevonTaig - https://stackoverflow.com/users/1069916/devontaig
Input
- The name of the resulting csv file
- The text that will be added in the csv file
Output
- A csv file with all the clipboard list contents
getClipboardText()
Finds all the items in the clipboard Chrome storage and adds them to the list that will be displayed on the UI
Input
- String of key for chrome storage
Output
- None
getContentFromClipboard()
- Source:
Gets content the user just copied from the clipboard. Creates a mock page to paste clipboard content and get it. Created from https://stackoverflow.com/questions/22702446/how-to-get-clipboard-data-in-chrome-extension and https://github.com/jeske/BBCodePaste/blob/master/bbcodepaste.js
Input
- None
- Requires browser clipboard to have something in it
Output
- Text content that the user just copied
getTheme()
Gets the theme preference the user has set
Input
- None
Output
- Sets the theme based off the last known user setting
getThumbnail()
Displays thumbnail for web links in clipboard
Input
- Copied link
Output
- Appropriate image thumbnail associated with the link
onContextMenuClick()
- Source:
Push link or image to the clipboard list.
Input
- None
Output
- None
- If conditions are met, the text is stored into the clipboard
onCopy()
Fires a message to the background page whenever the user triggers a copy action. Does not capture copied content.
Input
- The event that caused the trigger (unused)
Output
- None
- A "copy" message is sent to the background page
onCopyMessage()
- Source:
When user triggers a copy, capture the content they just copied and save it into the clipboard
Input
- None
Output
- None
- If conditions are met, the text is stored into the clipboard
readClipboardText()
- Source:
Checks if clipboardtext can be added and ads it if so. This is the main entrypoint for storing data in clipboard. Conditions to add:
- App must be toggled on
- Copied text must be non-empty
- Must be different from last read entry
Input
- Content copied by user, text only.
Output
- None
- Text is added to the clipboard list if conditions are met
saveClipboardList()
Saves clipboard list as a csv file
Input
- None
Output
- Downloads a csv file with all clipboard list contents
setImageFromLink()
- Source:
CURRENTLY UNUSED.
Take and image url and save it on the clipboard. This is done by converting it to base 64 data.
Input
- URL, must be pointing to an image resource
Output
- None
- Image data is converted to base64 and saved to clipboard
setSyncVariables()
- Source:
Create important variables. That are saved on Chrome's sync storage. List of variables:
- apptoggle: determines if the app captures from clipboard actions
- list: History of items copied from the clipboard
Input
- None
Output
- None
- The variables are created on sync storage
toggleExtension()
Turns the extension on or off while remembering its previous state
Input
- None
Output
- Opposite of the current active state
toggleTheme()
Toggles the theme to the opposite of the current (light/dark theme)
Input
- None
Output
- Changes the user theme preference to the opposite of the current theme