Skip to content

Commit 8d89735

Browse files
committed
[feature] add controls for link item content order
1 parent 8879c96 commit 8d89735

File tree

8 files changed

+133
-90
lines changed

8 files changed

+133
-90
lines changed

‎src/css/link.css‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@
6868
outline:0;
6969
}
7070

71-
.is-link-item-hover-scale .link-item:focus-within,
72-
.is-link-item-hover-scale .link-item:focus,
73-
.is-link-item-hover-scale .link-item:hover{
71+
.is-link-item-hoverscale .link-item:focus-within,
72+
.is-link-item-hoverscale .link-item:focus,
73+
.is-link-item-hoverscale .link-item:hover{
7474
transform:scale(1.05);
7575
}
7676

77-
.is-link-item-hover-scale .link-item:active{
77+
.is-link-item-hoverscale .link-item:active{
7878
transform:scale(1.04);
7979
transition: none;
8080
}
@@ -444,6 +444,11 @@
444444
transition: color var(--layout-transition-speed-fast) ease-in-out;
445445
}
446446

447+
.link-name,
448+
.link-name:not(:last-child){
449+
margin-bottom:0;
450+
}
451+
447452
.is-link-display-alignment-left .link-name{
448453
text-align: left;
449454
}

‎src/index.html‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,11 +549,11 @@ <h1 class="menu-item-header-text">Date</h1>
549549
<labelclass="control-header-date-format-label">Format</label>
550550
<divclass="input-wrap">
551551
<inputid="control-header-date-format-datemonth" class="control-header-date-format-datemonth" type="radio" name="control-header-date-format" value="datemonth" tabindex="1">
552-
<labelfor="control-header-date-format-datemonth">Date / Month</label>
552+
<labelfor="control-header-date-format-datemonth">Date/Month</label>
553553
</div>
554554
<divclass="input-wrap">
555555
<inputid="control-header-date-format-monthdate" class="control-header-date-format-monthdate" type="radio" name="control-header-date-format" value="monthdate" tabindex="1">
556-
<labelfor="control-header-date-format-monthdate">Month / Date</label>
556+
<labelfor="control-header-date-format-monthdate">Month/Date</label>
557557
</div>
558558
<hr>
559559
<divclass="input-wrap">
@@ -881,6 +881,16 @@ <h1 class="menu-item-header-text">Bookmarks</h1>
881881
</div>
882882
</div>
883883
</div>
884+
<hr>
885+
<divclass="input-wrap">
886+
<inputid="control-link-item-order-displayname" class="control-link-item-order-displayname" type="radio" name="control-link-item-order" value="displayname" tabindex="1">
887+
<labelfor="control-link-item-order-displayname">Letter/Icon then Name</label>
888+
</div>
889+
<divclass="input-wrap">
890+
<inputid="control-link-item-order-namedisplay" class="control-link-item-order-namedisplay" type="radio" name="control-link-item-order" value="namedisplay" tabindex="1">
891+
<labelfor="control-link-item-order-namedisplay">Name then Letter/Icon</label>
892+
<pclass="input-helper small muted">Only available when Letter/Icon and Name is shown.</p>
893+
</div>
884894
<hr>
885895
<divclass="input-wrap">
886896
<inputid="control-link-item-url-show" class="control-link-item-url-show" type="checkbox" tabindex="1">
@@ -893,8 +903,8 @@ <h1 class="menu-item-header-text">Bookmarks</h1>
893903
</div>
894904
<hr>
895905
<divclass="input-wrap">
896-
<inputid="control-link-item-hover-scale" class="control-link-item-hover-scale" type="checkbox" tabindex="1">
897-
<labelfor="control-link-item-hover-scale">Grow tile on hover</label>
906+
<inputid="control-link-item-hoverscale" class="control-link-item-hoverscale" type="checkbox" tabindex="1">
907+
<labelfor="control-link-item-hoverscale">Grow tile on hover</label>
898908
</div>
899909
<hr>
900910
<divclass="input-wrap">

‎src/js/control.js‎

Lines changed: 96 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,15 @@ var control = (function(){
17251725
func: function(){
17261726
link.render.item.size();
17271727
}
1728+
},{
1729+
element: helper.e(".control-link-show"),
1730+
path: "link.show",
1731+
type: "checkbox",
1732+
func: function(){
1733+
render();
1734+
dependents();
1735+
search.render.engine();
1736+
}
17281737
},{
17291738
element: helper.e(".control-link-item-size-default"),
17301739
type: "button",
@@ -1743,13 +1752,67 @@ var control = (function(){
17431752
update();
17441753
}
17451754
},{
1746-
element: helper.e(".control-link-show"),
1747-
path: "link.show",
1748-
type: "checkbox",
1755+
element: helper.e(".control-link-item-display-alignment-topleft"),
1756+
path: "link.item.display.alignment",
1757+
type: "radio",
1758+
func: function(){
1759+
render();
1760+
}
1761+
},{
1762+
element: helper.e(".control-link-item-display-alignment-topcenter"),
1763+
path: "link.item.display.alignment",
1764+
type: "radio",
1765+
func: function(){
1766+
render();
1767+
}
1768+
},{
1769+
element: helper.e(".control-link-item-display-alignment-topright"),
1770+
path: "link.item.display.alignment",
1771+
type: "radio",
1772+
func: function(){
1773+
render();
1774+
}
1775+
},{
1776+
element: helper.e(".control-link-item-display-alignment-centerleft"),
1777+
path: "link.item.display.alignment",
1778+
type: "radio",
1779+
func: function(){
1780+
render();
1781+
}
1782+
},{
1783+
element: helper.e(".control-link-item-display-alignment-centercenter"),
1784+
path: "link.item.display.alignment",
1785+
type: "radio",
1786+
func: function(){
1787+
render();
1788+
}
1789+
},{
1790+
element: helper.e(".control-link-item-display-alignment-centerright"),
1791+
path: "link.item.display.alignment",
1792+
type: "radio",
1793+
func: function(){
1794+
render();
1795+
}
1796+
},{
1797+
element: helper.e(".control-link-item-display-alignment-bottomleft"),
1798+
path: "link.item.display.alignment",
1799+
type: "radio",
1800+
func: function(){
1801+
render();
1802+
}
1803+
},{
1804+
element: helper.e(".control-link-item-display-alignment-bottomcenter"),
1805+
path: "link.item.display.alignment",
1806+
type: "radio",
1807+
func: function(){
1808+
render();
1809+
}
1810+
},{
1811+
element: helper.e(".control-link-item-display-alignment-bottomright"),
1812+
path: "link.item.display.alignment",
1813+
type: "radio",
17491814
func: function(){
17501815
render();
1751-
dependents();
1752-
search.render.engine();
17531816
}
17541817
},{
17551818
element: helper.e(".control-link-item-display-show"),
@@ -1791,14 +1854,6 @@ var control = (function(){
17911854
link.render.item.display.icon();
17921855
update();
17931856
}
1794-
},{
1795-
element: helper.e(".control-link-item-name-show"),
1796-
path: "link.item.name.show",
1797-
type: "checkbox",
1798-
func: function(){
1799-
render();
1800-
dependents();
1801-
}
18021857
},{
18031858
element: helper.e(".control-link-item-name-size"),
18041859
path: "link.item.name.size",
@@ -1816,87 +1871,50 @@ var control = (function(){
18161871
update();
18171872
}
18181873
},{
1819-
element: helper.e(".control-link-item-url-show"),
1820-
path: "link.item.url.show",
1821-
type: "checkbox",
1822-
func: function(){
1823-
render();
1824-
dependents();
1825-
}
1826-
},{
1827-
element: helper.e(".control-link-item-line-show"),
1828-
path: "link.item.line.show",
1829-
type: "checkbox",
1830-
func: function(){
1831-
render();
1832-
}
1833-
},{
1834-
element: helper.e(".control-link-item-hover-scale"),
1835-
path: "link.item.hoverScale",
1836-
type: "checkbox",
1837-
func: function(){
1838-
render();
1839-
}
1840-
},{
1841-
element: helper.e(".control-link-item-display-alignment-topleft"),
1842-
path: "link.item.display.alignment",
1843-
type: "radio",
1844-
func: function(){
1845-
render();
1846-
}
1847-
},{
1848-
element: helper.e(".control-link-item-display-alignment-topcenter"),
1849-
path: "link.item.display.alignment",
1850-
type: "radio",
1851-
func: function(){
1852-
render();
1853-
}
1854-
},{
1855-
element: helper.e(".control-link-item-display-alignment-topright"),
1856-
path: "link.item.display.alignment",
1857-
type: "radio",
1858-
func: function(){
1859-
render();
1860-
}
1861-
},{
1862-
element: helper.e(".control-link-item-display-alignment-centerleft"),
1863-
path: "link.item.display.alignment",
1874+
element: helper.e(".control-link-item-order-displayname"),
1875+
path: "link.item.order",
18641876
type: "radio",
18651877
func: function(){
1866-
render();
1878+
link.clear();
1879+
link.render.item.all();
1880+
sortable(".link-area");
18671881
}
18681882
},{
1869-
element: helper.e(".control-link-item-display-alignment-centercenter"),
1870-
path: "link.item.display.alignment",
1883+
element: helper.e(".control-link-item-order-namedisplay"),
1884+
path: "link.item.order",
18711885
type: "radio",
18721886
func: function(){
1873-
render();
1887+
link.clear();
1888+
link.render.item.all();
1889+
sortable(".link-area");
18741890
}
18751891
},{
1876-
element: helper.e(".control-link-item-display-alignment-centerright"),
1877-
path: "link.item.display.alignment",
1878-
type: "radio",
1892+
element: helper.e(".control-link-item-url-show"),
1893+
path: "link.item.url.show",
1894+
type: "checkbox",
18791895
func: function(){
18801896
render();
1897+
dependents();
18811898
}
18821899
},{
1883-
element: helper.e(".control-link-item-display-alignment-bottomleft"),
1884-
path: "link.item.display.alignment",
1885-
type: "radio",
1900+
element: helper.e(".control-link-item-line-show"),
1901+
path: "link.item.line.show",
1902+
type: "checkbox",
18861903
func: function(){
18871904
render();
18881905
}
18891906
},{
1890-
element: helper.e(".control-link-item-display-alignment-bottomcenter"),
1891-
path: "link.item.display.alignment",
1892-
type: "radio",
1907+
element: helper.e(".control-link-item-name-show"),
1908+
path: "link.item.name.show",
1909+
type: "checkbox",
18931910
func: function(){
18941911
render();
1912+
dependents();
18951913
}
18961914
},{
1897-
element: helper.e(".control-link-item-display-alignment-bottomright"),
1898-
path: "link.item.display.alignment",
1899-
type: "radio",
1915+
element: helper.e(".control-link-item-hoverscale"),
1916+
path: "link.item.hoverScale",
1917+
type: "checkbox",
19001918
func: function(){
19011919
render();
19021920
}
@@ -2362,7 +2380,7 @@ var control = (function(){
23622380
helper.removeClass(html,"is-link-display-alignment-bottomright");
23632381
helper.removeClass(html,"is-link-url-show");
23642382
helper.removeClass(html,"is-link-item-line-show");
2365-
helper.removeClass(html,"is-link-item-hover-scale");
2383+
helper.removeClass(html,"is-link-item-hoverscale");
23662384
helper.removeClass(html,"is-link-item-alignment-left");
23672385
helper.removeClass(html,"is-link-item-alignment-center");
23682386
helper.removeClass(html,"is-link-item-alignment-right");
@@ -2388,7 +2406,7 @@ var control = (function(){
23882406
helper.addClass(html,"is-link-item-line-show");
23892407
};
23902408
if(state.get().link.item.hoverScale){
2391-
helper.addClass(html,"is-link-item-hover-scale");
2409+
helper.addClass(html,"is-link-item-hoverscale");
23922410
};
23932411
if(state.get().link.edit){
23942412
helper.addClass(html,"is-link-edit");
@@ -2748,7 +2766,7 @@ var control = (function(){
27482766
helper.e(".control-link-item-name-size-default").disabled=true;
27492767
helper.e(".control-link-item-url-show").disabled=true;
27502768
helper.e(".control-link-item-line-show").disabled=true;
2751-
helper.e(".control-link-item-hover-scale").disabled=true;
2769+
helper.e(".control-link-item-hoverscale").disabled=true;
27522770
helper.e(".control-link-item-display-alignment-grid").setAttribute("disabled","");
27532771
helper.e(".control-link-item-display-alignment-label").setAttribute("disabled","");
27542772
helper.e(".control-link-item-display-alignment-topleft").disabled=true;
@@ -2786,7 +2804,7 @@ var control = (function(){
27862804
helper.e(".control-link-item-name-show").disabled=false;
27872805
helper.e(".control-link-item-url-show").disabled=false;
27882806
helper.e(".control-link-item-line-show").disabled=false;
2789-
helper.e(".control-link-item-hover-scale").disabled=false;
2807+
helper.e(".control-link-item-hoverscale").disabled=false;
27902808
helper.e(".control-link-newtab").disabled=false;
27912809
helper.e(".control-link-style-block").disabled=false;
27922810
helper.e(".control-link-style-list").disabled=false;

‎src/js/link.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,13 @@ var link = (function(){
497497
}elseif(data.display=="icon"&&data.icon.prefix!=null&&data.icon.name!=null){
498498
linkDisplay.appendChild(linkDisplayIcon);
499499
};
500-
linkPanelFront.appendChild(linkDisplay);
501-
linkPanelFront.appendChild(linkName);
500+
if(state.get().link.item.order=="displayname"){
501+
linkPanelFront.appendChild(linkDisplay);
502+
linkPanelFront.appendChild(linkName);
503+
}elseif(state.get().link.item.order=="namedisplay"){
504+
linkPanelFront.appendChild(linkName);
505+
linkPanelFront.appendChild(linkDisplay);
506+
};
502507
linkHandle.appendChild(linkHandleIcon);
503508
linkControl.appendChild(linkHandle);
504509
linkEdit.appendChild(linkEditIcon);

‎src/js/state.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ var state = (function(){
160160
hoverScale: {
161161
show: true
162162
},
163+
order: "displayname",
163164
size: 1,
164165
newTab: false
165166
},

‎src/js/update.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,10 @@ var update = (function(){
564564
};
565565
data.state.layout.order=data.state.layout.order.toLowerCase();
566566
returndata;
567+
},
568+
"3.30.0": function(data){
569+
data.state.link.item.order="displayname";
570+
returndata;
567571
}
568572
};
569573

‎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="3.29.1";
3+
varcurrent="3.30.0";
44

55
varcompare=function(a,b){
66
varpa=a.split(".");

‎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": "3.29.1",
5+
"version": "3.30.0",
66
"manifest_version": 2,
77
"chrome_url_overrides":{
88
"newtab": "index.html"

0 commit comments

Comments
(0)