Skip to content

Commit

Permalink
updated core styles for hover, blur, and background color additions s…
Browse files Browse the repository at this point in the history
…o would show above overlay.

updated to use background.js for turning features on/off
  • Loading branch information
spindle79 committed Oct 27, 2019
1 parent b53bb9e commit a4cbfb5
Show file tree
Hide file tree
Showing 14 changed files with 515 additions and 56 deletions.
274 changes: 274 additions & 0 deletions assets/contentful-logo.ai

Large diffs are not rendered by default.

41 changes: 30 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 15 additions & 4 deletions src/chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Contentful Sidekick",
"short_name": "Contentful Sidekick",
"description": "Chrome Extension that enables inline editing for websites created in Contentful",
"version": "0.0.6",
"version": "0.0.7",
"permissions": [
"activeTab",
"cookies",
Expand All @@ -14,13 +14,24 @@
"https://*/*",
"*://*/*"
],
"browser_action": {
"default_icon": "img/icon-128.png",
"default_popup": "html/popup.html"
"icons": {
"16": "img/icon16.png",
"32": "img/icon32.png",
"48": "img/icon48.png",
"64": "img/icon64.png",
"128": "img/icon128.png",
"256": "img/icon256.png"
},
"browser_action": {},
"background": {
"scripts": [
"js/background.js"
]
},
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"run_at": "document_idle",
"js": ["js/vendor.js", "js/content.js"],
"css": ["css/content.css"]
}
Expand Down
61 changes: 50 additions & 11 deletions src/shared/css/content.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,61 @@
.csk-element {
outline: 1px dashed #00a7f7;


[data-init-csk] [data-csk-entry-id] {
cursor: pointer;
position: relative;
transform: scale(1);
}
.csk-element:hover {
outline: 1px solid #00a7f7;
box-shadow: 0 0 0 4px rgba(0, 167, 247, 0.3);
[data-init-csk] [data-csk-entry-id]:hover {
z-index: 1031;
}

.csk-element:hover:before {
[data-init-csk] [data-csk-entry-id]:hover::before {
content: 'EDIT';
position: absolute;
padding: 2px 5px;
background-color: #00a4fa;
border-radius: 2px 2px 0 0;
background-color: #00a7f7;
border-radius: 0.25rem 0.25rem 0 0;
color: #FFF;
font-size: 9px;
font-size: 0.75rem;
font-weight: bold;
letter-spacing: 1px;
text-transform: uppercase;
margin-top: -16px;
top: -1.75rem;
left: -2px;
padding: 0.375rem 0.5rem 0.25rem 0.5rem;
}

[data-init-csk] [data-csk-entry-id]::after {
content: "";
position: absolute;
outline: 0.125rem dashed #00a7f7;
background-color: var(--bgColor);
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: -1;
}

[data-init-csk] [data-csk-entry-id]:hover::after {
outline: 0.125rem solid #00a7f7;
}

[data-init-csk] #csk-overlay {
transition: background-color 0.25s, backdrop-filter 0.25s;
transition-delay: 0.25s;
height: 100vh;
width: 100vw;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0);
backdrop-filter: blur(0);
z-index: -1;
}

[data-init-csk] #csk-overlay.show {
background-color: rgba(0, 0, 0, 0.1);
transition-delay: 0s;
backdrop-filter: blur(2px);
z-index: 1;
}
Binary file added src/shared/img/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/shared/img/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/shared/img/icon256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/shared/img/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/shared/img/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/shared/img/icon64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/shared/js/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* global chrome */
// Called when the user clicks on the browser action

const toggleActive = () => {
chrome.storage.sync.get({
sideKickEnabled: false,
}, (items) => {
const curEnabled = !items.sideKickEnabled;
chrome.storage.sync.set({ sideKickEnabled: curEnabled });

chrome.tabs.query({ active: true, currentWindow: true },
(tabs) => {
const activeTab = tabs[0];
chrome.tabs.sendMessage(activeTab.id,
{ message: curEnabled ? 'enable' : 'disable' });
});
});
};


chrome.browserAction.onClicked.addListener((tab) => {
toggleActive();
});
Loading

0 comments on commit a4cbfb5

Please sign in to comment.