Skip to content
This repository was archived by the owner on Nov 22, 2021. It is now read-only.

Commit 95dfaef

Browse files
oxxostudioKe, Mingze
authored and
Ke, Mingze
committed
add filter buttons
1 parent e4be46d commit 95dfaef

File tree

6 files changed

+67
-4
lines changed

6 files changed

+67
-4
lines changed

Diff for: code.js

+20
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,26 @@ Code.init = function(toolbox) {
889889
function(name_) {return function() {Code.tabClick(name_);};}(name));
890890
}
891891

892+
var filterBtn = document.querySelectorAll('.filterBtn');
893+
if(Code.getTags()[0]=='smart'){
894+
filterBtn[0].className = 'filterBtn';
895+
filterBtn[1].className = 'filterBtn selected';
896+
}
897+
filterBtn.forEach(function(item,index){
898+
filterBtn[index].onclick = function(){
899+
filterBtn.forEach(function(m,n){
900+
filterBtn[n].className = 'filterBtn';
901+
});
902+
filterBtn[index].className = 'filterBtn selected';
903+
var tagName = this.getAttribute('tag');
904+
if(tagName){
905+
window.history.pushState('tag', 'title', '/?tags=' + tagName);
906+
}else{
907+
window.history.pushState('tag', 'title', '/');
908+
}
909+
};
910+
});
911+
892912
onresize();
893913
};
894914

Diff for: css/style.css

+39
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,45 @@ html[dir="RTL"] .farSide {
1818
text-align: left;
1919
}
2020

21+
#mainTable{
22+
margin-left:42px;
23+
width:calc(100% - 42px);
24+
}
25+
26+
#blockFilter{
27+
width:42px;
28+
background:#333;
29+
position:fixed;
30+
top:110px;
31+
left:0;
32+
}
33+
34+
#blockFilter a{
35+
display:block;
36+
box-sizing:border-box;
37+
width:100%;
38+
height:36px;
39+
line-height:36px;
40+
text-align:center;
41+
color:#999;
42+
border-right-width:0px;
43+
border-right-style:solid;
44+
border-right-color:#f43;
45+
cursor:pointer;
46+
transition:.2s;
47+
}
48+
49+
#blockFilter a.selected{
50+
color:#fff;
51+
border-right-width:4px;
52+
background:#494949;
53+
}
54+
55+
#blockFilter a:hover{
56+
color:#fff;
57+
background:#494949;
58+
}
59+
2160

2261
/* Buttons */
2362

Diff for: msg/en.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var MSG = {
88
exportImage: "Download Image",
99
userMenuDashboard: "Dashboard",
1010
userMenuTutorials: "Tutorials",
11-
userMenuWebSite: "Support",
11+
userMenuWebSite: "Web Site",
1212
userMenuLogout: "Logout",
1313
blocks: "Blocks",
1414
linkTooltip: "Save and Link to Blocks",

Diff for: msg/zh-hans.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var MSG = {
88
exportImage: "下载图片",
99
userMenuDashboard: "专案管理",
1010
userMenuTutorials: "教学",
11-
userMenuWebSite: "资讯",
11+
userMenuWebSite: "官方网站",
1212
userMenuLogout: "登出",
1313
blocks: "积木",
1414
linkTooltip: "储存并产生连结",

Diff for: msg/zh-hant.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var MSG = {
88
exportImage: "下載圖片",
99
userMenuDashboard: "專案管理",
1010
userMenuTutorials: "教學",
11-
userMenuWebSite: "資訊",
11+
userMenuWebSite: "官網",
1212
userMenuLogout: "登出",
1313
blocks: "積木",
1414
linkTooltip: "儲存並產生連結",

Diff for: views/index.handlebars

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
<a href="#close" title="Close" class="close">X</a>
1515
</div>
1616
</div>
17-
<table width="100%" height="100%" class="nav">
17+
<div id="blockFilter">
18+
<a class="filterBtn selected">All</a>
19+
<a class="filterBtn" tag="smart">S</a>
20+
</div>
21+
<table class="nav" id="mainTable" height="100%">
1822
<tr>
1923
<td colspan=2>
2024
<table width="100%">

0 commit comments

Comments
 (0)