Skip to content

Commit 6c2cc2b

Browse files
committed
Enhance Extension Info Pane
Signed-off-by: Gary Kim <[email protected]>
1 parent 6b8da99 commit 6c2cc2b

File tree

4 files changed

+77
-12
lines changed

4 files changed

+77
-12
lines changed

src/.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
],
1313
"globals": {
1414
"Atomics": "readonly",
15-
"SharedArrayBuffer": "readonly"
15+
"SharedArrayBuffer": "readonly",
16+
"EXTENSION_VERSION_NAME": true
1617
},
1718
"parserOptions": {
1819
"parser": "babel-eslint",

src/js/components/ExtensionInfo.vue

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,21 @@
2020

2121
<template>
2222
<div id="saspes-info">
23-
<h3>
23+
<h3 @click="toggleInfo">
2424
<img
2525
:src="logo"
2626
class="saspes-logo"
2727
>
2828
SAS Powerschool Enhancement Suite
29+
<div
30+
:class="{ 'arrow-down': showInfo, 'arrow-left': !showInfo }"
31+
class="arrow"
32+
/>
2933
</h3>
30-
<div class="saspes-content">
34+
<div
35+
v-if="showInfo"
36+
class="saspes-content"
37+
>
3138
<p style="font-size: 1.5em;">
3239
Version: {{ version }}
3340
</p>
@@ -38,7 +45,7 @@
3845
href="https://github.com/gary-kim/saspes/"
3946
target="_blank"
4047
@click="link_analytics"
41-
>Project Website</a> |
48+
>Website/Source Code</a> |
4249
<a
4350
href="https://github.com/gary-kim/saspes/blob/master/CHANGELOG.md"
4451
class="saspes-link"
@@ -47,10 +54,10 @@
4754
>Changelog</a> |
4855
<a
4956
class="saspes-link"
50-
href="https://github.com/gary-kim/saspes"
57+
href="https://github.com/gary-kim/saspes/issues"
5158
target="_blank"
5259
@click="link_analytics"
53-
>Source Code</a> |
60+
>Issue Tracker</a> |
5461
<a
5562
class="saspes-link"
5663
href="https://github.com/gary-kim/saspes/blob/master/LICENSE"
@@ -61,7 +68,7 @@
6168
id="login-extension-settings"
6269
href="#"
6370
@click.prevent="open_settings"
64-
>Extension Options</a>
71+
>Options</a>
6572
</p>
6673
</div>
6774
</div>
@@ -74,7 +81,8 @@ export default {
7481
data() {
7582
return {
7683
logo: browser.runtime.getURL("icons/128.png"),
77-
version: browser.runtime.getManifest().version
84+
version: EXTENSION_VERSION_NAME,
85+
showInfo: false,
7886
};
7987
},
8088
methods: {
@@ -85,13 +93,17 @@ export default {
8593
args: { url: href, extra: { link: href } }
8694
});
8795
},
96+
toggleInfo() {
97+
this.showInfo = !this.showInfo;
98+
browser.storage.local.set({showExtensionInfo: this.showInfo});
99+
},
88100
open_settings() {
89101
browser.runtime.sendMessage({ action: "open_settings" });
90102
}
91103
}
92104
};
93105
</script>
94-
<style scoped>
106+
<style lang="less" scoped>
95107
#saspes-info {
96108
background-color: #FFF;
97109
box-shadow: 0 10px 20px rgba(0,0,0,0.4);
@@ -101,9 +113,22 @@ export default {
101113
padding: 0;
102114
font-size: inherit;
103115
color: #444444;
116+
117+
& > h3 {
118+
cursor: pointer;
119+
display: flex;
120+
align-items: center;
121+
padding: 5px 0;
122+
user-select: none;
123+
border-bottom: initial;
124+
}
125+
126+
.arrow {
127+
margin: 0 0 0 auto;
128+
}
104129
}
105130
.saspes-content {
106-
padding: 10px 20px 15px 20px;
131+
padding: 0 20px 10px 20px;
107132
}
108133
.saspes-logo {
109134
height: 2em;
@@ -112,4 +137,24 @@ export default {
112137
b {
113138
margin: initial !important;
114139
}
140+
.arrow {
141+
vertical-align: middle;
142+
transition-property: transform;
143+
transition-duration: 0.2s;
144+
145+
width: 0;
146+
height: 0;
147+
border-left: 5px solid transparent;
148+
border-right: 5px solid transparent;
149+
border-bottom: 5px solid grey;
150+
151+
&.arrow-left {
152+
transform: rotate(270deg);
153+
}
154+
155+
&.arrow-down {
156+
transform: rotate(180deg);
157+
}
158+
159+
}
115160
</style>

src/js/saspowerschoolff.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ function class_page() {
144144
}
145145
function login_page() {
146146
$('<div id="saspes-info"></div>').insertAfter('div#content');
147-
new (Vue.extend(ExtensionInfo))().$mount('#saspes-info');
147+
browser.storage.local.get({showExtensionInfo: true}).then(result => {
148+
new (Vue.extend(ExtensionInfo))({
149+
data: {
150+
showInfo: result.showExtensionInfo
151+
}
152+
}).$mount('#saspes-info');
153+
});
148154
}
149155
function fill_percent($fill_location,url_link,percents, pos_in_arr) {
150156
if(!percent_main_page) {

tests/extensionInfo.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,20 @@ module.exports = {
3333
"Extension Version Correct": browser => {
3434
browser
3535
.assert.containsText('#saspes-info', 'SAS Powerschool Enhancement Suite')
36-
.assert.containsText("#saspes-info", `Version: ${package.version}`)
36+
.assert.containsText("#saspes-info", `Version: ${package.version_name}`)
37+
},
38+
"Extension Info Remember Open State": browser => {
39+
browser
40+
.assert.elementPresent('#saspes-info .saspes-content')
41+
.click('#saspes-info .arrow')
42+
.assert.elementNotPresent('#saspes-info .saspes-content')
43+
.click('#saspes-info .arrow')
44+
.assert.elementPresent('#saspes-info .saspes-content')
45+
.click('#saspes-info .arrow')
46+
.refresh()
47+
.assert.elementNotPresent('#saspes-info .saspes-content')
48+
.click('#saspes-info .arrow')
49+
.assert.elementPresent('#saspes-info .saspes-content')
3750
.end()
3851
}
3952
}

0 commit comments

Comments
 (0)