1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

确认页直接跳转完成;更新jQuery版本;引入MyukiToast页内弹窗小工具

This commit is contained in:
程序员小墨 2023-01-07 04:59:45 +08:00
parent e90859286e
commit 2a18d6da17
11 changed files with 1007 additions and 11 deletions

View File

@ -1,6 +1,7 @@
const path = require("path")
const fs = require("fs")
const RedirectRule = require("./scripts/direct-url/RedirectRule")
/**
* manifest 修改之后记得执行下面这条命令重新 generate
@ -95,7 +96,8 @@ var manifest = {
"js": [
// "assets/js/lib/jquery.min.js",
// "assets/js/content.js",
// "assets/js/direct-url/url.js",
// Double S 快捷搜索 页面注入js
"scripts/advanced-search/content.js"
],
"css": [],
@ -112,7 +114,7 @@ var manifest = {
// "run_at": "document_start"
// },
// {
// // 自动展开模块
// // 阅读全文自动展开模块
// "matches": [
// "*://blog.csdn.net/*",
// "*://www.it1352.com/*"
@ -124,7 +126,7 @@ var manifest = {
// "run_at": "document_start"
// },
{
// 自动搜索模块
// Double S 快捷搜索 —— 自动搜索模块
"matches": [
"*://fanyi.qq.com/*",
"*://baike.baidu.com/*",
@ -137,7 +139,23 @@ var manifest = {
"scripts/advanced-search/content-helper.js"
],
"run_at": "document_start"
}
},
{
// 确认页直接跳转
"matches": Object.keys(RedirectRule).map(host => {
return `*://${host}${RedirectRule[host].path}*`
}),
"css": [
"html/assets/lib/myukitoast/myukitoast.css"
],
"js": [
"html/assets/lib/jquery-3.6.0.min.js",
"html/assets/lib/myukitoast/myukitoast.js",
"scripts/direct-url/RedirectRule.js",
"scripts/direct-url/url.js",
],
"run_at": "document_start"
},
],
"content_security_policy": {},

2
html/assets/lib/jquery-3.6.0.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
https://github.com/Uyukisan/MyukiToast
http://www.bootstrapmb.com/item/12789/preview

View File

@ -0,0 +1,707 @@
.myk-toast {
position: relative;
padding: .75rem 1.25rem;
margin-left: .5em;
margin-right: .5em;
border-radius: .25em;
border: 1px solid transparent;
box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
display: block;
/* flex: 0 0; */
}
.myk-toast:not(:last-child) {
margin-bottom: .75rem;
}
.myk-primary {
color: #004085;
background-color: #cce5ff;
border-color: #b8daff;
}
.myk-secondary {
color: #383d41;
background-color: #e2e3e5;
border-color: #d6d8db;
}
.myk-success {
color: #155724;
background-color: #d4edda;
border-color: #c3e6cb;
}
.myk-danger {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
}
.myk-warning {
color: #856404;
background-color: #fff3cd;
border-color: #ffeeba;
}
.myk-info {
color: #0c5460;
background-color: #d1ecf1;
border-color: #bee5eb;
}
.myk-light {
color: #818182;
background-color: #fefefe;
border-color: #fdfdfe;
}
.myk-dark {
color: #1b1e21;
background-color: #d6d8d9;
border-color: #c6c8ca;
}
.myk-toastlist {
position: absolute;
top: 0;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
-webkit-flex-direction: column;
flex-direction: column;
margin-top: .5em;
}
.myk-toastlist.center {
left: 50%;
transform: translateX(-50%);
}
.myk-toastlist.left {
left: 0;
}
.myk-toastlist.right {
right: 0;
}
.close {
display: none;
position: absolute;
color: inherit;
top: 0;
right: 0;
cursor: pointer;
border: 0;
background-color: transparent;
font-weight: bold;
line-height: 1;
font-size: 1.5rem;
}
.dismissible .close {
display: block;
}
.close:hover {
color: #2f3542;
text-decoration: none;
}
.myk-toast.show {
display: block;
opacity: 1;
}
.myk-toast.hide {
/* position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0; */
height: 0;
padding: 0;
margin: 0;
border: 0;
}
.nohideanimation {
display: none;
}
.fade {
transition: opacity 0.5s linear;
}
.fade:not(.show) {
opacity: 0;
}
@-webkit-keyframes normal-shake {
25% {
-webkit-transform: translateY(-2px);
transform: translateY(-2px);
}
75% {
-webkit-transform: translateY(2px);
transform: translateY(2px);
}
}
/**
* ----------------------------------------
* animation normal-shake
* ----------------------------------------
*/
@keyframes normal-shake {
25% {
-webkit-transform: translateY(-2px);
transform: translateY(-2px);
}
75% {
-webkit-transform: translateY(2px);
transform: translateY(2px);
}
}
.normal-shake {
-webkit-animation: .75s linear infinite normal-shake;
animation: .75s linear infinite normal-shake;
}
/**
* Thanks to [Animista - CSS Animations on Demand](https://animista.net/) for providing some cool and elegant animations.
*/
/**
* ----------------------------------------
* animation scale-out-center
* ----------------------------------------
*/
@-webkit-keyframes scale-out-center {
0% {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
100% {
-webkit-transform: scale(0);
transform: scale(0);
opacity: 1;
}
}
@keyframes scale-out-center {
0% {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
100% {
-webkit-transform: scale(0);
transform: scale(0);
opacity: 1;
}
}
.scale-out-center {
-webkit-animation: scale-out-center 0.5s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
animation: scale-out-center 0.5s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
}
/**
* ----------------------------------------
* animation fade-out
* ----------------------------------------
*/
@-webkit-keyframes fade-out {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes fade-out {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.fade-out {
-webkit-animation: fade-out 1s ease-out both;
animation: fade-out 1s ease-out both;
}
/**
* ----------------------------------------
* animation slide-out-top
* ----------------------------------------
*/
@-webkit-keyframes slide-out-top {
0% {
-webkit-transform: translateY(0);
transform: translateY(0);
opacity: 1;
}
100% {
-webkit-transform: translateY(-1000px);
transform: translateY(-1000px);
opacity: 0;
}
}
@keyframes slide-out-top {
0% {
-webkit-transform: translateY(0);
transform: translateY(0);
opacity: 1;
}
100% {
-webkit-transform: translateY(-1000px);
transform: translateY(-1000px);
opacity: 0;
}
}
.slide-out-top {
-webkit-animation: slide-out-top 0.5s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
animation: slide-out-top 0.5s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
}
/**
* ----------------------------------------
* animation puff-out-center
* ----------------------------------------
*/
@-webkit-keyframes puff-out-center {
0% {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-filter: blur(0px);
filter: blur(0px);
opacity: 1;
}
100% {
-webkit-transform: scale(2);
transform: scale(2);
-webkit-filter: blur(4px);
filter: blur(4px);
opacity: 0;
}
}
@keyframes puff-out-center {
0% {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-filter: blur(0px);
filter: blur(0px);
opacity: 1;
}
100% {
-webkit-transform: scale(2);
transform: scale(2);
-webkit-filter: blur(4px);
filter: blur(4px);
opacity: 0;
}
}
.puff-out-center {
-webkit-animation: puff-out-center 1s cubic-bezier(0.165, 0.840, 0.440, 1.000) both;
animation: puff-out-center 1s cubic-bezier(0.165, 0.840, 0.440, 1.000) both;
}
/**
* ----------------------------------------
* animation rotate-out-center
* ----------------------------------------
*/
@-webkit-keyframes rotate-out-center {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
opacity: 1;
}
100% {
-webkit-transform: rotate(-360deg);
transform: rotate(-360deg);
opacity: 0;
}
}
@keyframes rotate-out-center {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
opacity: 1;
}
100% {
-webkit-transform: rotate(-360deg);
transform: rotate(-360deg);
opacity: 0;
}
}
.rotate-out-center {
-webkit-animation: rotate-out-center 0.6s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
animation: rotate-out-center 0.6s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
}
/**
* ----------------------------------------
* animation jello-horizontal
* ----------------------------------------
*/
@-webkit-keyframes jello-horizontal {
0% {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
30% {
-webkit-transform: scale3d(1.25, 0.75, 1);
transform: scale3d(1.25, 0.75, 1);
}
40% {
-webkit-transform: scale3d(0.75, 1.25, 1);
transform: scale3d(0.75, 1.25, 1);
}
50% {
-webkit-transform: scale3d(1.15, 0.85, 1);
transform: scale3d(1.15, 0.85, 1);
}
65% {
-webkit-transform: scale3d(0.95, 1.05, 1);
transform: scale3d(0.95, 1.05, 1);
}
75% {
-webkit-transform: scale3d(1.05, 0.95, 1);
transform: scale3d(1.05, 0.95, 1);
}
100% {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
@keyframes jello-horizontal {
0% {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
30% {
-webkit-transform: scale3d(1.25, 0.75, 1);
transform: scale3d(1.25, 0.75, 1);
}
40% {
-webkit-transform: scale3d(0.75, 1.25, 1);
transform: scale3d(0.75, 1.25, 1);
}
50% {
-webkit-transform: scale3d(1.15, 0.85, 1);
transform: scale3d(1.15, 0.85, 1);
}
65% {
-webkit-transform: scale3d(0.95, 1.05, 1);
transform: scale3d(0.95, 1.05, 1);
}
75% {
-webkit-transform: scale3d(1.05, 0.95, 1);
transform: scale3d(1.05, 0.95, 1);
}
100% {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
.jello-horizontal {
-webkit-animation: jello-horizontal 0.9s infinite both;
animation: jello-horizontal 0.9s infinite both;
}
/**
* ----------------------------------------
* animation heartbeat
* ----------------------------------------
*/
@-webkit-keyframes heartbeat {
from {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-transform-origin: center center;
transform-origin: center center;
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
10% {
-webkit-transform: scale(0.91);
transform: scale(0.91);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
17% {
-webkit-transform: scale(0.98);
transform: scale(0.98);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
33% {
-webkit-transform: scale(0.87);
transform: scale(0.87);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
45% {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
}
@keyframes heartbeat {
from {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-transform-origin: center center;
transform-origin: center center;
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
10% {
-webkit-transform: scale(0.91);
transform: scale(0.91);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
17% {
-webkit-transform: scale(0.98);
transform: scale(0.98);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
33% {
-webkit-transform: scale(0.87);
transform: scale(0.87);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
45% {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
}
.heartbeat {
-webkit-animation: heartbeat 1.5s ease-in-out infinite both;
animation: heartbeat 1.5s ease-in-out infinite both;
}
/**
* ----------------------------------------
* animation wobble-hor-bottom
* ----------------------------------------
*/
@-webkit-keyframes wobble-hor-bottom {
0%,
100% {
-webkit-transform: translateX(0%);
transform: translateX(0%);
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
}
15% {
-webkit-transform: translateX(-30px) rotate(-6deg);
transform: translateX(-30px) rotate(-6deg);
}
30% {
-webkit-transform: translateX(15px) rotate(6deg);
transform: translateX(15px) rotate(6deg);
}
45% {
-webkit-transform: translateX(-15px) rotate(-3.6deg);
transform: translateX(-15px) rotate(-3.6deg);
}
60% {
-webkit-transform: translateX(9px) rotate(2.4deg);
transform: translateX(9px) rotate(2.4deg);
}
75% {
-webkit-transform: translateX(-6px) rotate(-1.2deg);
transform: translateX(-6px) rotate(-1.2deg);
}
}
@keyframes wobble-hor-bottom {
0%,
100% {
-webkit-transform: translateX(0%);
transform: translateX(0%);
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
}
15% {
-webkit-transform: translateX(-30px) rotate(-6deg);
transform: translateX(-30px) rotate(-6deg);
}
30% {
-webkit-transform: translateX(15px) rotate(6deg);
transform: translateX(15px) rotate(6deg);
}
45% {
-webkit-transform: translateX(-15px) rotate(-3.6deg);
transform: translateX(-15px) rotate(-3.6deg);
}
60% {
-webkit-transform: translateX(9px) rotate(2.4deg);
transform: translateX(9px) rotate(2.4deg);
}
75% {
-webkit-transform: translateX(-6px) rotate(-1.2deg);
transform: translateX(-6px) rotate(-1.2deg);
}
}
.wobble-hor-bottom {
-webkit-animation: wobble-hor-bottom 0.8s infinite both;
animation: wobble-hor-bottom 0.8s infinite both;
}
/**
* ----------------------------------------
* animation vibrate-1
* ----------------------------------------
*/
@-webkit-keyframes vibrate-1 {
0% {
-webkit-transform: translate(0);
transform: translate(0);
}
20% {
-webkit-transform: translate(-2px, 2px);
transform: translate(-2px, 2px);
}
40% {
-webkit-transform: translate(-2px, -2px);
transform: translate(-2px, -2px);
}
60% {
-webkit-transform: translate(2px, 2px);
transform: translate(2px, 2px);
}
80% {
-webkit-transform: translate(2px, -2px);
transform: translate(2px, -2px);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
@keyframes vibrate-1 {
0% {
-webkit-transform: translate(0);
transform: translate(0);
}
20% {
-webkit-transform: translate(-2px, 2px);
transform: translate(-2px, 2px);
}
40% {
-webkit-transform: translate(-2px, -2px);
transform: translate(-2px, -2px);
}
60% {
-webkit-transform: translate(2px, 2px);
transform: translate(2px, 2px);
}
80% {
-webkit-transform: translate(2px, -2px);
transform: translate(2px, -2px);
}
100% {
-webkit-transform: translate(0);
transform: translate(0);
}
}
.vibrate-1 {
-webkit-animation: vibrate-1 0.3s linear infinite both;
animation: vibrate-1 0.3s linear infinite both;
}
/**
* Thanks to [Animista - CSS Animations on Demand](https://animista.net/) for providing some cool and elegant animations.
*/

View File

@ -0,0 +1,121 @@
; (function (window) {
"use strict";
var defaultSetting = {
z_index: '9999',
position: 'center',
type: 'primary',
message: '⛄欢迎使用Myuki Toast👏',
dismissible: false,
originFadeDuration: 800,
animation: 'noanimation',
autoHideAnimation: 'nohideanimation',
maxExist: 10,
autoHide: true,
autoHideDelay: 3000,
defaultDom: 'MyukiToast',
gitHub: 'https://github.com/Uyukisan',
jq22: 'https://www.jq22.com/mem1320295',
release: 'https://github.com/Uyukisan/MyukiToast'
/*
primary,
secondary,
success,
danger,
warning,
info,
light,
dark
*/
};
Object.freeze(defaultSetting);
var MyukiToast = function (option, undefined) {
return new MyukiToast.fn.init(option, undefined);
};
var $ = window.jQuery;
MyukiToast.prototype = MyukiToast.fn = {
constructor: MyukiToast,
init: function (option, undefined) {
// console.log(this.help());
this._domName = defaultSetting.defaultDom;
let temp = $.extend({}, defaultSetting, arguments[1]);
// console.log(arguments);
typeof arguments[0] == 'string' ? this._domName = arguments[0].toString() : temp = $.extend({}, temp, arguments[0]);
this._setting = temp;
let dom = this.getDomName();
if ($(dom).length < 1) {
// console.log('No such dom: ' + dom);
let domName = defaultSetting.defaultDom + '-' + new Date().getTime();
let newDiv = $('<div></div>');
newDiv.attr('id', domName);
$('body').append(newDiv);
this._domName = '#' + domName;
// console.log('Generate a new dom: ' + this.getDomName());
}
dom = this.getDomName();
let setting = this.getSetting();
$(dom).addClass('myk-toastlist').addClass(setting.position);
$(dom).css({
'z-index': setting.z_index,
'width': setting.width,
'top': setting.top
});
return this;
},
getSetting: function () {
return this._setting;
},
getDomName: function () {
return this._domName;
},
// help: function () {
// console.log('%c⛄欢迎使用Myuki Toast👏', 'font-size:14px;border:20px solid #1e90ff;border-radius:10px;background:white;color:black;');
// console.log('访问以下地址获取Myuki Toast的用法。');
// return { 'GitHub': defaultSetting.gitHub, 'jQuery插件库': defaultSetting.jq22, 'Github仓库': defaultSetting.release };
// },
_addonemyukitoast: function (oneoption) {
let onesetting = this.getSetting();
onesetting = $.extend({}, onesetting, oneoption);
let dom = this.getDomName();
let toastOne = $('<div class="myk-toast show"><div class="toast-msg"></div><button class="close">×</button></div>');
toastOne.find('.toast-msg').text(onesetting.message);
toastOne.addClass('myk-' + onesetting.type).addClass(onesetting.animation);
toastOne.css({
'color': onesetting.color,
'font-size': onesetting.fontSize,
'font-family': onesetting.fontFamily,
'top': $(window).scrollTop()
});
$(window).scroll(function () {
toastOne.css({
'top': $(window).scrollTop()
});
});
onesetting.dismissible == true ? toastOne.addClass('dismissible') : toastOne.removeClass('dismissible');
$(dom).prepend(toastOne);
console.log('Add a toast: ' + onesetting.message);
let timer;
onesetting.autoHide == true ? timer = setTimeout(function () {
toastOne.removeClass(onesetting.animation).addClass(onesetting.autoHideAnimation);
onesetting.autoHideAnimation == 'originFade' ? toastOne.fadeOut(parseInt(onesetting.originFadeDuration)) : toastOne.removeClass('show').addClass('hide');
}, parseInt(onesetting.autoHideDelay)) : console.log("autoHide not set.");
toastOne.find('.close').on('click', function () {
timer ? clearTimeout(timer) : console.log('');
toastOne.remove();
});
$(dom).find('.myk-toast').length > onesetting.maxExist ? $(dom).find('.myk-toast').last().remove() : console.log('');
},
toast: function (option) {
let doOption = {};
typeof option == 'string' ? doOption.message = option.toString() : doOption = option;
this._addonemyukitoast(doOption);
}
}
MyukiToast.fn.init.prototype = MyukiToast.fn;
window.MyukiToast = MyukiToast;
window.$MT = MyukiToast;
return this;
})(window);

View File

@ -59,7 +59,7 @@
</ul>
</div>
</div>
<script src="assets/lib/jquery.min.js"></script>
<script src="assets/lib/jquery-3.6.0.min.js"></script>
<script src="assets/js/popup.js"></script>
</body>

View File

@ -1 +1 @@
{"manifest_version":3,"name":"小墨助手","version":"1.0.0","action":{"default_icon":{"16":"resources/image/logo.png","24":"resources/image/logo.png","32":"resources/image/logo.png"},"default_title":"点击打开小墨助手 配置页面","default_popup":"html/popup.html"},"description":"便捷,易用的浏览器小助手","icons":{"16":"resources/image/logo.png","32":"resources/image/logo.png","48":"resources/image/logo.png","128":"resources/image/logo.png"},"background":{"service_worker":"background.js"},"chrome_url_overrides":{},"commands":{"_execute_action":{"suggested_key":{"default":"Alt+Comma"}},"toggle-feature-foo":{"suggested_key":{"default":"Ctrl+Shift+U","mac":"Command+Shift+U"},"description":"Toggle feature foo","global":true}},"content_scripts":[{"matches":["<all_urls>","*://*/*"],"js":["scripts/advanced-search/content.js"],"css":[],"run_at":"document_start"},{"matches":["*://fanyi.qq.com/*","*://baike.baidu.com/*","*://fanyi.youdao.com/*","*://www.cnki.net/*","*://qikan.cqvip.com/*","*://lib.cqvip.com/*"],"js":["scripts/advanced-search/content-helper.js"],"run_at":"document_start"}],"content_security_policy":{},"cross_origin_embedder_policy":{},"cross_origin_opener_policy":{},"event_rules":[],"file_browser_handlers":[],"file_system_provider_capabilities":{},"host_permissions":[],"incognito":"spanning","input_components":[],"minimum_chrome_version":"107","omnibox":{"keyword":"ss"},"optional_host_permissions":[],"optional_permissions":[],"options_page":"html/options.html","options_ui":{},"permissions":["commands","bookmarks","contextMenus","storage","webNavigation"],"requirements":{},"sandbox":{},"storage":{},"tts_engine":{},"version_name":"1.0 beta","web_accessible_resources":[]}
{"manifest_version":3,"name":"小墨助手","version":"1.0.0","action":{"default_icon":{"16":"resources/image/logo.png","24":"resources/image/logo.png","32":"resources/image/logo.png"},"default_title":"点击打开小墨助手 配置页面","default_popup":"html/popup.html"},"description":"便捷,易用的浏览器小助手","icons":{"16":"resources/image/logo.png","32":"resources/image/logo.png","48":"resources/image/logo.png","128":"resources/image/logo.png"},"background":{"service_worker":"background.js"},"chrome_url_overrides":{},"commands":{"_execute_action":{"suggested_key":{"default":"Alt+Comma"}},"toggle-feature-foo":{"suggested_key":{"default":"Ctrl+Shift+U","mac":"Command+Shift+U"},"description":"Toggle feature foo","global":true}},"content_scripts":[{"matches":["<all_urls>","*://*/*"],"js":["scripts/advanced-search/content.js"],"css":[],"run_at":"document_start"},{"matches":["*://fanyi.qq.com/*","*://baike.baidu.com/*","*://fanyi.youdao.com/*","*://www.cnki.net/*","*://qikan.cqvip.com/*","*://lib.cqvip.com/*"],"js":["scripts/advanced-search/content-helper.js"],"run_at":"document_start"},{"matches":["*://c.pc.qq.com/middlem.html*","*://docs.qq.com/scenario/link.html*","*://www.tianyancha.com/security*","*://jump.bdimg.com/safecheck/index*","*://jump2.bdimg.com/safecheck/index*","*://www.chinaz.com/go.shtml*","*://www.douban.com/link2/*","*://link.csdn.net/*","*://link.zhihu.com/*","*://link.juejin.cn/*","*://links.jianshu.com/go*","*://www.jianshu.com/go-wild*"],"css":["html/assets/lib/myukitoast/myukitoast.css"],"js":["html/assets/lib/jquery-3.6.0.min.js","html/assets/lib/myukitoast/myukitoast.js","scripts/direct-url/RedirectRule.js","scripts/direct-url/url.js"],"run_at":"document_start"}],"content_security_policy":{},"cross_origin_embedder_policy":{},"cross_origin_opener_policy":{},"event_rules":[],"file_browser_handlers":[],"file_system_provider_capabilities":{},"host_permissions":[],"incognito":"spanning","input_components":[],"minimum_chrome_version":"107","omnibox":{"keyword":"ss"},"optional_host_permissions":[],"optional_permissions":[],"options_page":"html/options.html","options_ui":{},"permissions":["commands","bookmarks","contextMenus","storage","webNavigation"],"requirements":{},"sandbox":{},"storage":{},"tts_engine":{},"version_name":"1.0 beta","web_accessible_resources":[]}

View File

@ -0,0 +1,60 @@
/**
* 规则定义
*/
const RedirectRule = {
// 腾讯QQ
"c.pc.qq.com": {
path: "/middlem.html",
param: "pfurl",
},
// 腾讯文档
"docs.qq.com": {
path: "/scenario/link.html",
param: "url",
},
"www.tianyancha.com": {
path: "/security",
param: "target",
},
"jump.bdimg.com": {
path: "/safecheck/index",
param: "url",
},
"jump2.bdimg.com": {
path: "/safecheck/index",
param: "url",
},
"www.chinaz.com": {
path: "/go.shtml",
param: "url",
},
"www.douban.com": {
path: "/link2/",
param: "url",
},
"link.csdn.net": {
path: "/",
param: "target",
},
"link.zhihu.com": {
path: "/",
param: "target",
},
"link.juejin.cn": {
path: "/",
param: "target",
},
"links.jianshu.com": {
path: "/go",
param: "url",
},
"www.jianshu.com": {
path: "/go-wild", // "/go-wild?ac=2&url="
param: "url",
},
// QQ、腾讯文档、天眼查、百度贴吧、站长之家、豆瓣、Zaker、开发者知识库、CSDN、知乎、掘金、简书etc...
}
if (typeof module !== 'undefined') {
module.exports = RedirectRule
}

View File

@ -0,0 +1,18 @@
/**
* 测试用网址:
* 知乎
* https://link.zhihu.com/?target=http%3A//only4.work
*
* 腾讯文档
* https://docs.qq.com/scenario/link.html?url=only4.work
*
* CSDN
* https://link.csdn.net/?target=https%3A//only4.work
*
* 简书
* https://links.jianshu.com/go?to=http%3A%2F%2Fwww.only4.work%2F
* https://www.jianshu.com/go-wild?ac=2&url=http%3A%2F%2Fwww.only4.work%2F
*
* QQ
* https://c.pc.qq.com/middlem.html?pfurl=https%3A%2F%2Fwww.only4.work%2F&pfuin=2291200076&pfto=qq.msg&type=0&gjlevel=15&gjsublevel=2804&iscontinue=0&ADUIN=2291200076&ADSESSION=1673029605&ADTAG=CLIENT.QQ.5941_AIO.0&ADPUBNO=27268
*/

73
scripts/direct-url/url.js Normal file
View File

@ -0,0 +1,73 @@
window.onload = function () {
// 判断功能是否启用
let isEnabled = new Promise((resolve) => {
chrome.storage.sync.get("State_DirectUrl", ({ State_DirectUrl }) => {
resolve(State_DirectUrl)
})
})
if (!isEnabled) {
console.log("[小墨助手]", "确认跳转页直接跳转功能未开启,将不进行跳转")
return;
}
console.log("[小墨助手]", "确认跳转页直接跳转模块加载成功")
// 创建一个MyukiToast的实例 // $MT = MyukiToast
// let toastObj = $MT("#xiaomo_chrome_extension_toast")
let toastObj = $MT("", {
'type': 'info', // 'type': 'warning',
'top': '60px',
'fontSize': '16px',
'width': '300px',
"dismissible": false,
'autoHide': false,
'animation': 'normal-shake' // 'vibrate-2', 'heartbeat'
})
// 获取参数
function getParams(key) {
let dict = {}
location.search.substring(1).split("&").forEach(str => {
let s = str.split("=")
dict[s[0]] = s.length > 1 ? s[1] : null
})
if (!key) return dict
else return dict[key]
}
function redirect() {
let url = location.href
let host = location.host
let path = location.pathname
let search = location.search
// console.log(url, host, path, search)
// 匹配 host
const rule = RedirectRule[host]
if (!rule) return
console.log("host匹配成功")
// 匹配 path
console.log(`real path: [${path}], rule path: [${rule.path}]`)
if (!path.startsWith(rule.path)) return
console.log("path匹配成功")
// 调用toast方法
toastObj.toast("[小墨助手] 正在自动跳转⛄️")
// 获取参数
let target = decodeURIComponent(getParams(rule.param))
// 如果不是 http(s):// 开头,则手动添加 schema
if (!target.startsWith("http"))
target = "http://" + target
// 跳转
// location.replace(target)
location.href = target
}
// setTimeout(redirect, 500)
redirect()
}