Skip to content

Commit 966aa0b

Browse files
committed
Added url params function and new feedback page
1 parent 9aec6a2 commit 966aa0b

4 files changed

Lines changed: 88 additions & 19 deletions

File tree

docs/index.html

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</div>
4646
<div class="mdui-drawer" id="left-drawer">
4747
<ul class="mdui-list">
48-
<a href="javascript: pageFunctions.entryArea0.showMainPage()">
48+
<a href="javascript: pageFunctions.entryArea0.switchToMainPage()">
4949
<li id="item-main-main" class="mdui-list-item mdui-ripple">
5050
<i class="mdui-list-item-icon mdui-icon"><svg style="opacity: 0.75" viewBox="0 0 1024 1024"
5151
width="23" height="23">
@@ -103,7 +103,7 @@
103103
</a>
104104
<li class="mdui-divider"></li>
105105
<a href="javascript: pageFunctions.entryArea2.feedbackNewNotifyRules()">
106-
<li class="mdui-list-item mdui-ripple">
106+
<li id="item-feedback-feedback" class="mdui-list-item mdui-ripple">
107107
<i class="mdui-list-item-icon mdui-icon"><svg style="opacity: 0.75" viewBox="0 0 1024 1024"
108108
width="21" height="21">
109109
<path
@@ -172,17 +172,28 @@
172172
</ul>
173173
</div>
174174
<div class="mdui-container-fluid">
175+
<div id="page-not-found" style="display: none">
176+
<div style="text-align: center">
177+
<br /><br /><br />
178+
<span style="font-size: 55pt">404</span>
179+
<br /><br /><br />
180+
<span style="font-size: 18pt; opacity: 0.66">找不到你要访问的页面,请再试一次。</span>
181+
</div>
182+
</div>
175183
<div id="page-main">
176184
<div id="page-main-markdown-content" class="markdown-body-box markdown-body"></div>
177185
</div>
178-
<div id="page-notify-rules" style="display: none;">
186+
<div id="page-notify-rules" style="display: none">
179187
<div id="load-fail-text-box" style="text-align: center; display: none">
180188
<br /><br /><br />
181189
<span style="font-size: 15pt; opacity: 0.55">数据加载失败,请检查网络连接后重试。</span>
182190
</div>
183191
<ul id="data-list" class="mdui-list" />
184192
</div>
185-
<div id="page-contribute">
193+
<div id="page-feedback" style="display: none">
194+
<div id="page-feedback-markdown-content" class="markdown-body-box markdown-body"></div>
195+
</div>
196+
<div id="page-contribute" style="display: none">
186197
<div id="page-contribute-markdown-content" class="markdown-body-box markdown-body"></div>
187198
</div>
188199
</div>

docs/resources/js/markdown-contents.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const markdownContents = {
22
syncNotice:
3-
'目前通知图标规则仅限使用于我 (<strong>@fankes</strong>) 开发的通知图标修复与增强 Xposed 模块以及部分经过授权的合作方项目。\n\n' +
3+
'目前通知图标规则仅限使用于我 (<strong>@fankes</strong>) 正在开发的通知图标相关模块与项目合作者使用。\n\n' +
44
'如果你想手动获取在线规则平台的所有数据,你可以点击侧边栏的“贡献通知图标规则”前往页面底部的同步列表地址进行查看。',
55
authorize:
66
'在线规则平台的全部数据所有权属于 <strong>@fankes</strong> 与本仓库的所有贡献者所有,' +

docs/resources/js/markdown-page-contents.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ const markdownPageContents = {
4545
'- SmartisanOS\n\n' +
4646
'## 通知测试\n\n' +
4747
'你可以 [点击这里](https://github.com/fankes/AndroidNotifyIconAdapt/raw/main/tool/NotifyTester.apk) 下载工具测试通知图标是否符合原生规范。',
48+
feedback:
49+
'# 提交适配请求\n\n' +
50+
'欢迎为通知图标优化名单贡献宝贵资源!\n\n' +
51+
'## 如何提交\n\n' +
52+
'目前的提交适配请求方式为在 **GitHub** 创建一个 `issues`。\n\n' +
53+
'你需要前往 **GitHub** 使用指定的模版创建一个 `issues`。\n\n' +
54+
'管理员看到你创建的 `issues` 后会进行处理,最快 1-3 个工作日内完成。\n\n' +
55+
'适配完成后 `issues` 会被关闭并标记为完成,同步云端规则即可获取最新的适配数据。\n\n' +
56+
'如果你没有 **GitHub** 帐号,请先注册,[点击这里](https://github.com/fankes/AndroidNotifyIconAdapt/issues/new?assignees=&labels=To+be+adapted&template=request_notify_icon_adaption.yml) 立即创建一个 `issues`。\n\n' +
57+
'## 适配说明\n\n' +
58+
'以下类型的 APP 不予适配:\n\n' +
59+
'- VPN、翻墙软件\n' +
60+
'- 涉嫌色情、赌博类软件\n' +
61+
'- 申请超限权限、涉嫌泄露国家机密行为的软件\n\n' +
62+
'以下类型的 APP 通知图标暂不适配:\n\n' +
63+
'- 多态彩色图标,状态不唯一,例如 360 极速浏览器\n' +
64+
'- 规范的原生图标,但未被通知图标规则适配的 (将稍后加入白名单)',
4865
contributing:
4966
'# 开始贡献\n\n' +
5067
'欢迎为通知图标优化名单贡献宝贵资源!\n\n' +

docs/resources/js/render.js

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,42 @@ const constValues = {
22
tooSmallScreenMinWidth: 600,
33
defaultNotifyIconColor: '#555555',
44
telegramContactLink: 'https://t.me/XiaofangInternet',
5-
repoSourceUrl: 'https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main/',
6-
feedbackNewNotifyRulesUrl: 'https://github.com/fankes/AndroidNotifyIconAdapt/issues/new?assignees=&labels=To+be+adapted&template=request_notify_icon_adaption.yml'
5+
repoSourceUrl: 'https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main/'
76
};
87

98
function onPageLoad() {
10-
pageFunctions.entryArea0.showMainPage();
9+
switch (renderController.getUrlParams()) {
10+
case '':
11+
case 'main':
12+
pageFunctions.entryArea0.switchToMainPage();
13+
break;
14+
case 'notify-rules-app':
15+
pageFunctions.entryArea1.requestDataForApp();
16+
break;
17+
case 'notify-rules-system':
18+
pageFunctions.entryArea1.requestDataForSystem();
19+
break;
20+
case 'notify-rules-miui':
21+
pageFunctions.entryArea1.requestDataForMiui();
22+
break;
23+
case 'notify-rules-coloros':
24+
pageFunctions.entryArea1.requestDataForColorOs();
25+
break;
26+
case 'feedback':
27+
pageFunctions.entryArea2.feedbackNewNotifyRules();
28+
break;
29+
case 'contribute':
30+
pageFunctions.entryArea2.contributeNotifyRules();
31+
break;
32+
default:
33+
pageFunctions.specialCase.switchToNotFoundPage();
34+
break;
35+
}
1136
pageFunctions.entryArea3.showAuthorize(true);
1237
}
1338

1439
const renderController = {
40+
getUrlParams: () => window.location.search.replace('?', ''),
1541
generateMarkdownContent: (content) => marked.parse(content),
1642
setMarkdownContent: (id, content) => {
1743
$('#' + id).html(renderController.generateMarkdownContent(content));
@@ -49,20 +75,23 @@ const renderController = {
4975
};
5076

5177
const pageController = {
52-
pageTitles: ['首页', '通知图标优化名单', '贡献通知图标规则'],
78+
pageTitles: ['页面不存在', '首页', '通知图标优化名单', '请求适配新 APP', '贡献通知图标规则'],
5379
isPageBlocked: false,
54-
switchToPage: (title, pageId, itemId) => {
80+
switchToPage: (title, pageId, itemId = undefined) => {
5581
$('#item-main-main').removeClass('mdui-list-item-active');
5682
$('#item-nfrules-app').removeClass('mdui-list-item-active');
5783
$('#item-nfrules-miui').removeClass('mdui-list-item-active');
5884
$('#item-nfrules-coloros').removeClass('mdui-list-item-active');
5985
$('#item-nfdebug-debug').removeClass('mdui-list-item-active');
86+
$('#item-feedback-feedback').removeClass('mdui-list-item-active');
6087
$('#item-contribute-contribute').removeClass('mdui-list-item-active');
88+
$('#page-not-found').hide();
6189
$('#page-main').hide();
6290
$('#page-notify-rules').hide();
91+
$('#page-feedback').hide();
6392
$('#page-contribute').hide();
6493
$('#' + pageId).show();
65-
$('#' + itemId).addClass('mdui-list-item-active');
94+
if (itemId !== undefined) $('#' + itemId).addClass('mdui-list-item-active');
6695
pageController.changePageTitle(title);
6796
pageController.scrollToTop();
6897
},
@@ -83,6 +112,14 @@ const pageController = {
83112
};
84113

85114
const pageFunctions = {
115+
specialCase: {
116+
switchToNotFoundPage: () => {
117+
if (pageController.isPageBlocked) return;
118+
pageController.switchToPage(pageController.pageTitles[0], 'page-not-found');
119+
pageController.showOrHideSyncNoticeIcon(false);
120+
pageController.showOrHideProjectAddressIcon(true);
121+
}
122+
},
86123
headerArea0: {
87124
showSyncNotice: () => {
88125
mdui.dialog({
@@ -94,9 +131,9 @@ const pageFunctions = {
94131
}
95132
},
96133
entryArea0: {
97-
showMainPage: () => {
134+
switchToMainPage: () => {
98135
if (pageController.isPageBlocked) return;
99-
pageController.switchToPage(pageController.pageTitles[0], 'page-main', 'item-main-main');
136+
pageController.switchToPage(pageController.pageTitles[1], 'page-main', 'item-main-main');
100137
pageController.showOrHideSyncNoticeIcon(false);
101138
pageController.showOrHideProjectAddressIcon(true);
102139
renderController.setMarkdownContent('page-main-markdown-content', markdownPageContents.home);
@@ -105,7 +142,7 @@ const pageFunctions = {
105142
entryArea1: {
106143
requestDataForApp: () => {
107144
if (pageController.isPageBlocked) return;
108-
pageController.switchToPage(pageController.pageTitles[1], 'page-notify-rules', 'item-nfrules-app');
145+
pageController.switchToPage(pageController.pageTitles[2], 'page-notify-rules', 'item-nfrules-app');
109146
pageController.showOrHideSyncNoticeIcon(true);
110147
pageController.showOrHideProjectAddressIcon(window.innerWidth > constValues.tooSmallScreenMinWidth);
111148
nfDataRequestController.requestData('APP');
@@ -116,26 +153,30 @@ const pageFunctions = {
116153
},
117154
requestDataForMiui: () => {
118155
if (pageController.isPageBlocked) return;
119-
pageController.switchToPage(pageController.pageTitles[1], 'page-notify-rules', 'item-nfrules-miui');
156+
pageController.switchToPage(pageController.pageTitles[2], 'page-notify-rules', 'item-nfrules-miui');
120157
pageController.showOrHideSyncNoticeIcon(true);
121158
pageController.showOrHideProjectAddressIcon(window.innerWidth > constValues.tooSmallScreenMinWidth);
122159
nfDataRequestController.requestData('OS/MIUI');
123160
},
124161
requestDataForColorOs: () => {
125162
if (pageController.isPageBlocked) return;
126-
pageController.switchToPage(pageController.pageTitles[1], 'page-notify-rules', 'item-nfrules-coloros');
163+
pageController.switchToPage(pageController.pageTitles[2], 'page-notify-rules', 'item-nfrules-coloros');
127164
pageController.showOrHideSyncNoticeIcon(true);
128165
pageController.showOrHideProjectAddressIcon(window.innerWidth > constValues.tooSmallScreenMinWidth);
129166
nfDataRequestController.requestData('OS/ColorOS');
130167
}
131168
},
132169
entryArea2: {
133170
feedbackNewNotifyRules: () => {
134-
window.open(constValues.feedbackNewNotifyRulesUrl, '_blank');
171+
if (pageController.isPageBlocked) return;
172+
pageController.switchToPage(pageController.pageTitles[3], 'page-feedback', 'item-feedback-feedback');
173+
pageController.showOrHideSyncNoticeIcon(false);
174+
pageController.showOrHideProjectAddressIcon(true);
175+
renderController.setMarkdownContent('page-feedback-markdown-content', markdownPageContents.feedback);
135176
},
136177
contributeNotifyRules: () => {
137178
if (pageController.isPageBlocked) return;
138-
pageController.switchToPage(pageController.pageTitles[2], 'page-contribute', 'item-contribute-contribute');
179+
pageController.switchToPage(pageController.pageTitles[4], 'page-contribute', 'item-contribute-contribute');
139180
pageController.showOrHideSyncNoticeIcon(false);
140181
pageController.showOrHideProjectAddressIcon(true);
141182
renderController.setMarkdownContent('page-contribute-markdown-content', markdownPageContents.contributing);
@@ -185,7 +226,7 @@ const nfDataRequestController = {
185226
dataType: 'json',
186227
success: (result) => {
187228
$('#loading-icon').hide();
188-
pageController.changePageTitle(pageController.pageTitles[1] + '&nbsp(' + result.length + ')');
229+
pageController.changePageTitle(pageController.pageTitles[2] + '&nbsp(' + result.length + ')');
189230
result.forEach((element, index) => {
190231
let jsonString = encodeURI(JSON.stringify(element, null, 2));
191232
$('#data-list').append('<li class="mdui-list-item mdui-ripple" style="white-space: nowrap"' +

0 commit comments

Comments
 (0)