Skip to content

Commit 30815c1

Browse files
committed
[refactor] store link and background colour under rgb key in state data
1 parent 0ef6cbc commit 30815c1

File tree

10 files changed

+39
-32
lines changed

10 files changed

+39
-32
lines changed

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nighttab",
3-
"version": "4.21.1",
3+
"version": "4.22.0",
44
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
55
"main": "index.js",
66
"scripts":{

‎src/index.html‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,8 +1330,8 @@ <h1 class="menu-item-header-text">Background colour</h1>
13301330
<divclass="form-indent">
13311331
<divclass="form-wrap">
13321332
<divclass="form-group form-group-block">
1333-
<inputid="control-link-item-color-by-picker" class="form-group-item-half control-link-item-color-by-picker" type="color" value="#000000" tabindex="1">
1334-
<inputid="control-link-item-color-by-hex" class="form-group-item-half control-link-item-color-by-hex" type="text" placeholder="Hex code" value="#000000" tabindex="1" maxlength="7" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
1333+
<inputid="control-link-item-color-rgb-picker" class="form-group-item-half control-link-item-color-rgb-picker" type="color" value="#000000" tabindex="1">
1334+
<inputid="control-link-item-color-rgb-hex" class="form-group-item-half control-link-item-color-rgb-hex" type="text" placeholder="Hex code" value="#000000" tabindex="1" maxlength="7" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
13351335
</div>
13361336
</div>
13371337
</div>
@@ -1871,8 +1871,8 @@ <h1 class="menu-item-header-text">Colour</h1>
18711871
<divclass="form-indent">
18721872
<divclass="form-wrap">
18731873
<divclass="form-group form-group-block">
1874-
<inputid="control-background-color-by-picker" class="form-group-item-half control-background-color-by-picker" type="color" value="#000000" tabindex="1">
1875-
<inputid="control-background-color-by-hex" class="form-group-item-half control-background-color-by-hex" type="text" placeholder="Hex code" value="#000000" tabindex="1" maxlength="7" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
1874+
<inputid="control-background-color-picker" class="form-group-item-half control-background-color-picker" type="color" value="#000000" tabindex="1">
1875+
<inputid="control-background-color-hex" class="form-group-item-half control-background-color-hex" type="text" placeholder="Hex code" value="#000000" tabindex="1" maxlength="7" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
18761876
</div>
18771877
</div>
18781878
</div>

‎src/js/background.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var background = (function(){
7171

7272
render.color={
7373
custom: function(){
74-
helper.e("html").style.setProperty("--background-color-custom",state.get.current().background.color.custom.r+", "+state.get.current().background.color.custom.g+", "+state.get.current().background.color.custom.b);
74+
helper.e("html").style.setProperty("--background-color-custom",state.get.current().background.color.rgb.r+", "+state.get.current().background.color.rgb.g+", "+state.get.current().background.color.rgb.b);
7575
},
7676
clearHTML: function(){
7777
helper.e("html").style.backgroundColor="";
@@ -127,10 +127,10 @@ var background = (function(){
127127
helper.e(".control-background-image-file").value="";
128128
},
129129
picker: function(){
130-
helper.e(".control-background-color-by-picker").value=helper.convertColor.rgb.hex(state.get.current().background.color.custom);
130+
helper.e(".control-background-color-picker").value=helper.convertColor.rgb.hex(state.get.current().background.color.rgb);
131131
},
132132
hex: function(){
133-
helper.e(".control-background-color-by-hex").value=helper.convertColor.rgb.hex(state.get.current().background.color.custom);
133+
helper.e(".control-background-color-hex").value=helper.convertColor.rgb.hex(state.get.current().background.color.rgb);
134134
}
135135
};
136136

‎src/js/control.js‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,16 +2530,16 @@ var control = (function(){
25302530
render.class();
25312531
}
25322532
},{
2533-
element: helper.e(".control-link-item-color-by-picker"),
2534-
path: "link.item.color.custom",
2533+
element: helper.e(".control-link-item-color-rgb-picker"),
2534+
path: "link.item.color.rgb",
25352535
type: "color",
25362536
func: function(){
25372537
link.render.item.color.custom();
25382538
link.render.input.hex();
25392539
}
25402540
},{
2541-
element: helper.e(".control-link-item-color-by-hex"),
2542-
path: "link.item.color.custom",
2541+
element: helper.e(".control-link-item-color-rgb-hex"),
2542+
path: "link.item.color.rgb",
25432543
type: "text",
25442544
valueMod: ["hexTextString"],
25452545
func: function(){
@@ -3151,16 +3151,16 @@ var control = (function(){
31513151
render.class();
31523152
}
31533153
},{
3154-
element: helper.e(".control-background-color-by-picker"),
3155-
path: "background.color.custom",
3154+
element: helper.e(".control-background-color-picker"),
3155+
path: "background.color.rgb",
31563156
type: "color",
31573157
func: function(){
31583158
background.render.color.custom();
31593159
background.render.input.hex();
31603160
}
31613161
},{
3162-
element: helper.e(".control-background-color-by-hex"),
3163-
path: "background.color.custom",
3162+
element: helper.e(".control-background-color-hex"),
3163+
path: "background.color.rgb",
31643164
type: "text",
31653165
valueMod: ["hexTextString"],
31663166
func: function(){
@@ -4173,8 +4173,8 @@ var control = (function(){
41734173
_disable.element(".control-link-item-color-by-theme-helper",true);
41744174
_disable.input(".control-link-item-color-by-custom",true);
41754175
_disable.element(".control-link-item-color-by-custom-helper",true);
4176-
_disable.input(".control-link-item-color-by-picker",true);
4177-
_disable.input(".control-link-item-color-by-hex",true);
4176+
_disable.input(".control-link-item-color-rgb-picker",true);
4177+
_disable.input(".control-link-item-color-rgb-hex",true);
41784178
_disable.element("[for=control-link-item-border]",true);
41794179
_disable.input(".control-link-item-border",true);
41804180
_disable.element(".control-link-item-border-count",true);
@@ -4295,8 +4295,8 @@ var control = (function(){
42954295
_disable.input(".control-link-item-display-gutter-default",false);
42964296
};
42974297
if(state.get.current().link.item.color.by=="custom"){
4298-
_disable.input(".control-link-item-color-by-picker",false);
4299-
_disable.input(".control-link-item-color-by-hex",false);
4298+
_disable.input(".control-link-item-color-rgb-picker",false);
4299+
_disable.input(".control-link-item-color-rgb-hex",false);
43004300
};
43014301
};
43024302
};
@@ -4387,11 +4387,11 @@ var control = (function(){
43874387
_disable.element(".control-background-image-url-helper",true);
43884388
};
43894389
if(state.get.current().background.color.by=="theme"){
4390-
_disable.input(".control-background-color-by-picker",true);
4391-
_disable.input(".control-background-color-by-hex",true);
4390+
_disable.input(".control-background-color-picker",true);
4391+
_disable.input(".control-background-color-hex",true);
43924392
}elseif(state.get.current().background.color.by=="custom"){
4393-
_disable.input(".control-background-color-by-picker",false);
4394-
_disable.input(".control-background-color-by-hex",false);
4393+
_disable.input(".control-background-color-picker",false);
4394+
_disable.input(".control-background-color-hex",false);
43954395
};
43964396
};
43974397
_header();

‎src/js/link.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ var link = (function(){
547547
render.item={
548548
color: {
549549
custom: function(){
550-
helper.e("html").style.setProperty("--link-item-color-custom",state.get.current().link.item.color.custom.r+", "+state.get.current().link.item.color.custom.g+", "+state.get.current().link.item.color.custom.b);
550+
helper.e("html").style.setProperty("--link-item-color-custom",state.get.current().link.item.color.rgb.r+", "+state.get.current().link.item.color.rgb.g+", "+state.get.current().link.item.color.rgb.b);
551551
}
552552
},
553553
link: function(){
@@ -1714,10 +1714,10 @@ var link = (function(){
17141714

17151715
render.input={
17161716
picker: function(){
1717-
helper.e(".control-link-item-color-by-picker").value=helper.convertColor.rgb.hex(state.get.current().link.item.color.custom);
1717+
helper.e(".control-link-item-color-rgb-picker").value=helper.convertColor.rgb.hex(state.get.current().link.item.color.rgb);
17181718
},
17191719
hex: function(){
1720-
helper.e(".control-link-item-color-by-hex").value=helper.convertColor.rgb.hex(state.get.current().link.item.color.custom);
1720+
helper.e(".control-link-item-color-rgb-hex").value=helper.convertColor.rgb.hex(state.get.current().link.item.color.rgb);
17211721
}
17221722
};
17231723

‎src/js/state.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ var state = (function(){
144144
item: {
145145
color: {
146146
by: "theme",
147-
custom: {
147+
rgb: {
148148
r: 0,
149149
g: 0,
150150
b: 0
@@ -273,7 +273,7 @@ var state = (function(){
273273
background: {
274274
color: {
275275
by: "theme",
276-
custom: {
276+
rgb: {
277277
r: 0,
278278
g: 0,
279279
b: 0

‎src/js/update.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,13 @@ var update = (function(){
783783
});
784784
});
785785
returndata;
786+
},
787+
"4.22.0": function(data){
788+
data.state.link.item.color.rgb=data.state.link.item.color.custom;
789+
deletedata.state.link.item.color.custom;
790+
data.state.background.color.rgb=data.state.background.color.custom;
791+
deletedata.state.background.color.custom;
792+
returndata;
786793
}
787794
};
788795

‎src/js/version.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
varversion=(function(){
22

3-
varcurrent="4.21.1";
3+
varcurrent="4.22.0";
44

55
varname="Naughty Goose";
66

‎src/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nightTab",
33
"short_name": "nightTab",
44
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
5-
"version": "4.21.1",
5+
"version": "4.22.0",
66
"manifest_version": 2,
77
"chrome_url_overrides":{
88
"newtab": "index.html"

0 commit comments

Comments
(0)