Skip to content

Commit 9f3bedd

Browse files
committed
Init
0 parents  commit 9f3bedd

File tree

10 files changed

+191
-0
lines changed

10 files changed

+191
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignored/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Kevin BON
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# webextension--bootstrap-responsiveHelper

background/bg.responsiveHelper.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const TITLE = "Bootstrap - Responsible Helper";
2+
3+
function updateIcon(params) {
4+
let icon = null;
5+
if (!params.bootstrapActive) {
6+
return;
7+
} else if (params.viewportWidth < 768) {
8+
icon = '/icons/size_xs.svg';
9+
} else if (params.viewportWidth >= 1200) {
10+
icon = '/icons/size_lg.svg';
11+
} else if (params.viewportWidth >= 992) {
12+
icon = '/icons/size_md.svg';
13+
} else if (params.viewportWidth >= 768) {
14+
icon = '/icons/size_sm.svg';
15+
} else {
16+
return;
17+
}
18+
browser.pageAction.show(params.tabId);
19+
browser.pageAction.setIcon({tabId: params.tabId, path: icon });
20+
browser.pageAction.setTitle({tabId: params.tabId, title: TITLE });
21+
}
22+
23+
function onContentScriptNotification(message, context) {
24+
updateIcon({
25+
bootstrapActive: message.bootstrapActive,
26+
viewportWidth: message.viewportWidth,
27+
tabId: context.tab.id
28+
});
29+
}
30+
31+
browser.runtime.onMessage.addListener(onContentScriptNotification);

icons/icon.png

1.43 KB
Loading

icons/size_lg.svg

Lines changed: 24 additions & 0 deletions
Loading

icons/size_md.svg

Lines changed: 23 additions & 0 deletions
Loading

icons/size_sm.svg

Lines changed: 23 additions & 0 deletions
Loading

icons/size_xs.svg

Lines changed: 22 additions & 0 deletions
Loading

manifest.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"manifest_version": 2,
3+
"name": "bootstrap-responsiveHelper",
4+
"description": "Show the bootstrap grid class currently active (XS, SM, MD, LG)",
5+
"version": "1.0",
6+
"homepage_url": "https://github.com/KevinBon/webextension--bootstrap-responsiveHelper",
7+
8+
"developer": {
9+
"name": "Kevin BON",
10+
"url": "https://github.com/KevinBon"
11+
},
12+
13+
"icons": {
14+
"32": "icons/icon.png"
15+
},
16+
17+
"permissions": [
18+
"activeTab",
19+
"tabs"
20+
],
21+
22+
"background": {
23+
"scripts": ["background/bg.responsiveHelper.js"]
24+
},
25+
26+
"page_action": {
27+
"default_icon": "icons/icon.png",
28+
"browser_style": true
29+
},
30+
31+
"web_accessible_resources": [
32+
"icons/size_lg.svg",
33+
"icons/size_md.svg",
34+
"icons/size_sm.svg",
35+
"icons/size_xs.svg"
36+
],
37+
38+
"content_scripts": [
39+
{
40+
"matches": ["<all_urls>"],
41+
"js": ["content_scripts/ct.responsiveHelper.js"]
42+
}
43+
]
44+
45+
}

0 commit comments

Comments
 (0)