Added url params function and new feedback page

This commit is contained in:
2023-02-06 00:39:54 +08:00
parent 9aec6a28ed
commit 966aa0bf05
4 changed files with 88 additions and 19 deletions

View File

@@ -45,7 +45,7 @@
</div>
<div class="mdui-drawer" id="left-drawer">
<ul class="mdui-list">
<a href="javascript: pageFunctions.entryArea0.showMainPage()">
<a href="javascript: pageFunctions.entryArea0.switchToMainPage()">
<li id="item-main-main" class="mdui-list-item mdui-ripple">
<i class="mdui-list-item-icon mdui-icon"><svg style="opacity: 0.75" viewBox="0 0 1024 1024"
width="23" height="23">
@@ -103,7 +103,7 @@
</a>
<li class="mdui-divider"></li>
<a href="javascript: pageFunctions.entryArea2.feedbackNewNotifyRules()">
<li class="mdui-list-item mdui-ripple">
<li id="item-feedback-feedback" class="mdui-list-item mdui-ripple">
<i class="mdui-list-item-icon mdui-icon"><svg style="opacity: 0.75" viewBox="0 0 1024 1024"
width="21" height="21">
<path
@@ -172,17 +172,28 @@
</ul>
</div>
<div class="mdui-container-fluid">
<div id="page-not-found" style="display: none">
<div style="text-align: center">
<br /><br /><br />
<span style="font-size: 55pt">404</span>
<br /><br /><br />
<span style="font-size: 18pt; opacity: 0.66">找不到你要访问的页面,请再试一次。</span>
</div>
</div>
<div id="page-main">
<div id="page-main-markdown-content" class="markdown-body-box markdown-body"></div>
</div>
<div id="page-notify-rules" style="display: none;">
<div id="page-notify-rules" style="display: none">
<div id="load-fail-text-box" style="text-align: center; display: none">
<br /><br /><br />
<span style="font-size: 15pt; opacity: 0.55">数据加载失败,请检查网络连接后重试。</span>
</div>
<ul id="data-list" class="mdui-list" />
</div>
<div id="page-contribute">
<div id="page-feedback" style="display: none">
<div id="page-feedback-markdown-content" class="markdown-body-box markdown-body"></div>
</div>
<div id="page-contribute" style="display: none">
<div id="page-contribute-markdown-content" class="markdown-body-box markdown-body"></div>
</div>
</div>

View File

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

View File

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

View File

@@ -2,16 +2,42 @@ const constValues = {
tooSmallScreenMinWidth: 600,
defaultNotifyIconColor: '#555555',
telegramContactLink: 'https://t.me/XiaofangInternet',
repoSourceUrl: 'https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main/',
feedbackNewNotifyRulesUrl: 'https://github.com/fankes/AndroidNotifyIconAdapt/issues/new?assignees=&labels=To+be+adapted&template=request_notify_icon_adaption.yml'
repoSourceUrl: 'https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main/'
};
function onPageLoad() {
pageFunctions.entryArea0.showMainPage();
switch (renderController.getUrlParams()) {
case '':
case 'main':
pageFunctions.entryArea0.switchToMainPage();
break;
case 'notify-rules-app':
pageFunctions.entryArea1.requestDataForApp();
break;
case 'notify-rules-system':
pageFunctions.entryArea1.requestDataForSystem();
break;
case 'notify-rules-miui':
pageFunctions.entryArea1.requestDataForMiui();
break;
case 'notify-rules-coloros':
pageFunctions.entryArea1.requestDataForColorOs();
break;
case 'feedback':
pageFunctions.entryArea2.feedbackNewNotifyRules();
break;
case 'contribute':
pageFunctions.entryArea2.contributeNotifyRules();
break;
default:
pageFunctions.specialCase.switchToNotFoundPage();
break;
}
pageFunctions.entryArea3.showAuthorize(true);
}
const renderController = {
getUrlParams: () => window.location.search.replace('?', ''),
generateMarkdownContent: (content) => marked.parse(content),
setMarkdownContent: (id, content) => {
$('#' + id).html(renderController.generateMarkdownContent(content));
@@ -49,20 +75,23 @@ const renderController = {
};
const pageController = {
pageTitles: ['首页', '通知图标优化名单', '贡献通知图标规则'],
pageTitles: ['页面不存在', '首页', '通知图标优化名单', '请求适配新 APP', '贡献通知图标规则'],
isPageBlocked: false,
switchToPage: (title, pageId, itemId) => {
switchToPage: (title, pageId, itemId = undefined) => {
$('#item-main-main').removeClass('mdui-list-item-active');
$('#item-nfrules-app').removeClass('mdui-list-item-active');
$('#item-nfrules-miui').removeClass('mdui-list-item-active');
$('#item-nfrules-coloros').removeClass('mdui-list-item-active');
$('#item-nfdebug-debug').removeClass('mdui-list-item-active');
$('#item-feedback-feedback').removeClass('mdui-list-item-active');
$('#item-contribute-contribute').removeClass('mdui-list-item-active');
$('#page-not-found').hide();
$('#page-main').hide();
$('#page-notify-rules').hide();
$('#page-feedback').hide();
$('#page-contribute').hide();
$('#' + pageId).show();
$('#' + itemId).addClass('mdui-list-item-active');
if (itemId !== undefined) $('#' + itemId).addClass('mdui-list-item-active');
pageController.changePageTitle(title);
pageController.scrollToTop();
},
@@ -83,6 +112,14 @@ const pageController = {
};
const pageFunctions = {
specialCase: {
switchToNotFoundPage: () => {
if (pageController.isPageBlocked) return;
pageController.switchToPage(pageController.pageTitles[0], 'page-not-found');
pageController.showOrHideSyncNoticeIcon(false);
pageController.showOrHideProjectAddressIcon(true);
}
},
headerArea0: {
showSyncNotice: () => {
mdui.dialog({
@@ -94,9 +131,9 @@ const pageFunctions = {
}
},
entryArea0: {
showMainPage: () => {
switchToMainPage: () => {
if (pageController.isPageBlocked) return;
pageController.switchToPage(pageController.pageTitles[0], 'page-main', 'item-main-main');
pageController.switchToPage(pageController.pageTitles[1], 'page-main', 'item-main-main');
pageController.showOrHideSyncNoticeIcon(false);
pageController.showOrHideProjectAddressIcon(true);
renderController.setMarkdownContent('page-main-markdown-content', markdownPageContents.home);
@@ -105,7 +142,7 @@ const pageFunctions = {
entryArea1: {
requestDataForApp: () => {
if (pageController.isPageBlocked) return;
pageController.switchToPage(pageController.pageTitles[1], 'page-notify-rules', 'item-nfrules-app');
pageController.switchToPage(pageController.pageTitles[2], 'page-notify-rules', 'item-nfrules-app');
pageController.showOrHideSyncNoticeIcon(true);
pageController.showOrHideProjectAddressIcon(window.innerWidth > constValues.tooSmallScreenMinWidth);
nfDataRequestController.requestData('APP');
@@ -116,14 +153,14 @@ const pageFunctions = {
},
requestDataForMiui: () => {
if (pageController.isPageBlocked) return;
pageController.switchToPage(pageController.pageTitles[1], 'page-notify-rules', 'item-nfrules-miui');
pageController.switchToPage(pageController.pageTitles[2], 'page-notify-rules', 'item-nfrules-miui');
pageController.showOrHideSyncNoticeIcon(true);
pageController.showOrHideProjectAddressIcon(window.innerWidth > constValues.tooSmallScreenMinWidth);
nfDataRequestController.requestData('OS/MIUI');
},
requestDataForColorOs: () => {
if (pageController.isPageBlocked) return;
pageController.switchToPage(pageController.pageTitles[1], 'page-notify-rules', 'item-nfrules-coloros');
pageController.switchToPage(pageController.pageTitles[2], 'page-notify-rules', 'item-nfrules-coloros');
pageController.showOrHideSyncNoticeIcon(true);
pageController.showOrHideProjectAddressIcon(window.innerWidth > constValues.tooSmallScreenMinWidth);
nfDataRequestController.requestData('OS/ColorOS');
@@ -131,11 +168,15 @@ const pageFunctions = {
},
entryArea2: {
feedbackNewNotifyRules: () => {
window.open(constValues.feedbackNewNotifyRulesUrl, '_blank');
if (pageController.isPageBlocked) return;
pageController.switchToPage(pageController.pageTitles[3], 'page-feedback', 'item-feedback-feedback');
pageController.showOrHideSyncNoticeIcon(false);
pageController.showOrHideProjectAddressIcon(true);
renderController.setMarkdownContent('page-feedback-markdown-content', markdownPageContents.feedback);
},
contributeNotifyRules: () => {
if (pageController.isPageBlocked) return;
pageController.switchToPage(pageController.pageTitles[2], 'page-contribute', 'item-contribute-contribute');
pageController.switchToPage(pageController.pageTitles[4], 'page-contribute', 'item-contribute-contribute');
pageController.showOrHideSyncNoticeIcon(false);
pageController.showOrHideProjectAddressIcon(true);
renderController.setMarkdownContent('page-contribute-markdown-content', markdownPageContents.contributing);
@@ -185,7 +226,7 @@ const nfDataRequestController = {
dataType: 'json',
success: (result) => {
$('#loading-icon').hide();
pageController.changePageTitle(pageController.pageTitles[1] + '&nbsp(' + result.length + ')');
pageController.changePageTitle(pageController.pageTitles[2] + '&nbsp(' + result.length + ')');
result.forEach((element, index) => {
let jsonString = encodeURI(JSON.stringify(element, null, 2));
$('#data-list').append('<li class="mdui-list-item mdui-ripple" style="white-space: nowrap"' +