FirefoxBar / HeaderEditor

Manage browser's requests, include modify the request headers and response headers, redirect requests, cancel requests
https://he.firefoxcn.net/
GNU General Public License v2.0
956 stars 326 forks source link

看一下 规则转换 Error .js #21

Closed ghost closed 7 years ago

ghost commented 7 years ago

//转域名 { name: "userscripts转Mirror", from: /^https?:\/\/(userscripts.org(?:\:8080|)|(?:www.|)webextender.net)\/(.)/i, to: "http://userscripts-mirror.org/$2", regex: true },{ name: "魂+转北+", from: /^http:\/\/(.{4})?((soul|north|south).plus|imoutolove).\w+(.)/i, to: "https://bbs.white-plus.net$4", regex: true },{ name: "Firefox FTP", from: /^(http|ftp):\/\/ftp.(mozilla.org.)/i, to: "http://archive.$2", regex: true },{ name: "火狐范重定向", from: /^http:\/\/(www.)?firefoxfan.(net|com|cc)(.)/i, to: "http://firefoxfan.org$3", regex: true //网站好像挂了 },{ name: "琉璃神社重定向", from: /^https?:\/\/www.hacg.(?!fi)\w{2,3}(\/.)/i, to: "https://www.hacg.fi$1", regex: true }, //封面大图 { name: "QQ音乐专辑封面大图", from: /^(https:\/\/y.gtimg.cn\/music\/.)?300x300(.jpg)(.)/i, to: "$1500x500$2", regex: true },{ name: "网易云专辑歌单封面大图", from: /^(http:\/\/p..music.126.net\/.jpg).param=((1|2).0.)/i, to: "$1", regex: true },{ name: "虾米专辑歌单封面大图", from: /^(http:\/\/pic.xiami.net\/images\/album\/.jpg)(@.)/i, to: "$1", regex: true },{ name: "iTunes专辑封面大图", from: /^(https?:\/\/is.-ssl.mzstatic.com\/image\/thumb\/Music.\/source\/).0w.jpg/i, to: "$11200x1200.jpg", regex: true },{ name: "ebay封面原始大图", from: /^(https?:\/\/i.ebayimg.com\/(?:\w+\/|))(images\/g\/\w+\/s-l)(?!1600)\d+.(\w+)/i, to: "$1$21600.$3", regex: true },{ name: "哔哩哔哩视频封面大图", from: /^(https?:\/\/i..hdslb.com.)(\d{2,3}x\d{2,3}|@\d{2,3}w\d{2,3}h).(jpg|png)/i, to: "$1", regex: true },{ name: "tradingfloor原始大图", from: /^https?:\/\/www.tradingfloor.com\/images\/article\/max608w\/(.)/i, to: "https://www.tradingfloor.com/images/article/original/$1", regex: true },{ name: "500px原始大图", from: /^https?:\/\/gp1.wac.edgecastcdn.net\/806614\/photos\/photos.500px.net\/(.)\/(.)\/[\d].jpg+(\/.)?/i, to: "https://gp1.wac.edgecastcdn.net/806614/photos/photos.500px.net/$1/$2/2048.jpg", regex: true },{ name: "百度百科原始大图", from: /^https?:\/\/(imgsa.baidu.com\/baike\/)\w.+\/sign=.(\/\w+.jpg)/i, to: "https://$1pic/item$2", regex: true },{ name: "酷安原始大图", from: /(^http:\/\/image.coolapk.com\/(feed|apkimage)\/..jpg)./i, to: "$1", regex: true },{ name: "Lofter原始大图", from: /(^https?:\/\/imglf.?.nosdn.127.net\/img\/..\w+)\?./i, to: "$1", regex: true },{ name: "Tumblr原始大图", from: /(^https?:\/\/\d+.media.tumblr.com\/.*tumblr\w+_)(?!1280)\d+(.\w+)./i, to: "$11280$2", regex: true },{ name: "Pinterest原始大图", from: /(^https?:\/\/(?:s-|)media-cache-ak0.pinimg.com\/)\d+x(..\w+)./i, to: "$1originals$2", regex: true },{ name: "果壳原始大图", from: /(^https?:\/\/\d.im.guokr.com\/..\w+)\?./i, to: "$1", regex: true },{ name: "Pixiv原始大图", from: /(^https?:\/\/i.pximg.net\/)c\/600x600\/img-master(\/img\/.)_master1200(.jpg)\/?.*/i, to: "$1img-original$2$3", regex: true, state: false //已禁用,网速太慢大图加载不出来,对网速自信的可以删除本行以启用规则 },

//HTTP/HTTPS { name: "哔哩哔哩转https", from: /^http:\/\/(\w+.bilibili.\w{2,3}\/.)/i, to: "https://$1", regex: true },{ name: "优酷转https", from: /^http:\/\/(\w+.youku.com(\/?$|sprite.gif$))/i, to: "https://$1", regex: true, },{ name: "微博转https", from: /^http:\/\/((www.)?(weibo|sinaimg).(com|cn)\/(?!.topnav|\?|ajaxlogin|logout).+)/i, to: "https://$1", regex: true, },{ name: "imgur外链转http", from: /^https:\/\/(i.imgur.com\/.)/i, to: "http://$1", regex: true },{ name: "mozest转http", from: /https:\/\/([a-z].mozest.com\/.)/i, to: "http://$1", regex: true }, //手机版跳转 { name: "天涯论坛手机版跳转", from: /^(http:\/\/bbs.tianya.cn\/)m\/(.)/i, to: "$1$2", regex: true },{ name: "百度百科手机版跳转", from: /^(http:\/\/)wap(baike.baidu.com\/.)/i, to: "$1$2", regex: true },{ name: "萌娘百科手机版跳转", from: /^https?:\/\/m.(moegirl.org)(\/.)/i, to: "https://zh.$1/zh$2", regex: true },{ name: "百度搜索手机版跳转", from: /^https?:\/\/m(.baidu.com\/).from=.(\/|&)(.)/i, to: "https://www$1s?$3", regex: true },{ name: "acfun手机版跳转", from: /^https?:\/\/m(.acfun.tv\/v\/).ac=(.)/i, to: "http://www$1ac$2", regex: true },{ name: "bilibili手机版跳转", from: /^(https?:\/\/www.bilibili.com\/)mobile\/(.).html/i, to: "$1$2", regex: true },{ name: "dilidili手机版跳转", from: /^http:\/\/m(.dilidili.\w+\/.)/i, to: "http://www$1", regex: true },{ name: "新浪微博手机版跳转", from: /^(https?:\/\/)(m.)?weibo.cn(\/u\/.)/i, to: "$1weibo.com$3", regex: true },{ name: "微博文章手机版跳转", from: /^https?:\/\/media.weibo.cn\/article(\?id=\d+)./i, to: "https://weibo.com/ttarticle/p/show$1", regex: true },{ name: "V2EX手机版跳转", from: /^(https?:\/\/www.v2ex.com)\/amp(\/t\/.)/i, to: "$1$2", regex: true },{ name: "推特手机版跳转", from: /^(https?:\/\/)mobile.(twitter.com\/.)/i, to: "$1$2", regex: true },{ name: "酷狗手机版跳转", from: /^(https?:\/\/)m.(kugou.com\/)plist\/list\/(.)/i, to: "$1www.$2yy/special/single/$3.html", regex: true }, //外链去跳转 { name: "贴吧链接去跳转", from: /^https?:\/\/jump2?.bdimg.com\/(.)/i, to: "http://tieba.baidu.com/$1", regex: true },{ name: "豆瓣链接去跳转", from: /^https?:\/\/www.douban.com\/link2\?url=(http.)/i, to: "$1", regex: true },{ name: "知乎链接去跳转", from: /^https?:\/\/(link|www).zhihu.com\/(\?target=|question\/.)(http.)/i, to: "$3", regex: true },{ name: "好搜结果去跳转", from: /^https?:\/\/www.so.com\/link\?url=(.)/i, to: "$1", regex: true, decode: true },{ name: "WordPress博客去跳转", from: /^https?:\/\/.\/go(.php|\/)\?url=(http.)/i, to: "$2", regex: true },{ name: "Pixiv去跳转", from: /^https?:\/\/www.pixiv.net\/jump.php\?(http.)/i, to: "$1", regex: true },{ name: "Deviantart去跳转", from: /^https?:\/\/www.deviantart.com\/users\/outgoing\?(http.)/i, to: "$1", regex: true },{ name: "AMO链接去跳转", from: /^https?:\/\/outgoing.prod.mozaws.net\/.\/(http.)/i, to: "$1", regex: true }, //简体中文 { name: "GreasyFork转简中", from: /^(https?:\/\/greasyfork.org\/)(?!zh-CN).{2,5}($|\/.)/i, to: "$1zh-CN$2", regex: true },{ name: "维基中文转简中", from: /^https?:(\/\/zh.wikipedia.org\/).{5}(\/.)/i, to: 'https:$1wiki$2', regex: true },{ name: "火狐附加组件简中", from: /^(https:\/\/addons.mozilla.org\/(?!zh-CN)).{2,5}(\/.)/i, to: "$1zh-CN$2", regex: true }, //Google服务转科大博客,https://servers.ustclug.org/index.php/2014/06/blog-googlefonts-speedup/ { name: "ajax/fonts >> 科大博客", from: /^https?:\/\/(ajax|fonts).googleapis.com\/(.)/i, to: "https://$1.proxy.ustclug.org/$2", regex: true },{ name: "fonts >> 科大博客", from: /^https?:\/\/(fonts.gstatic).com\/(.)/i, to: "https://$1.proxy.ustclug.org/$2", regex: true, state: false },{ name: "themes >> 科大博客", from: /^https?:\/\/(themes).(google)usercontent.com\/(.)/i, to: "https://$2-$1.proxy.ustclug.org/$3", regex: true },{ name: "gerrit >> 科大博客", from: /^(https?:\/\/gerrit).(googlesource).com\/(.)/i, to: "$1-$2.proxy.ustclug.org/$3", regex: true },{ name: "推特谷歌社交插件CDN", from: /^https?:\/\/(platform.twitter.com\/|apis.google.com\/js\/)(widgets|api|plusone).js(.)/i, to: "https://cdn.rawgit.com/jiacai2050/gooreplacer/gh-pages/proxy/$2.js$3", regex: true, state: false //CDN的JS文件版本过旧 }, //谷歌系 { name: "google链接加密", from: /^http:\/\/(([^.]+.)?google..+)/i, exclude: /google.cn/i, to: "https://$1", regex: true },{ name: "google搜索去多余参数", from: /^(https?:\/\/www.google..{2,6}\/search\?).(?:(?:safe|source|newwindow)=.(q=[^&]+)|(q=[^&]+).(?:ved|newwindow)=)./i, to: function(r) { var a = r[0].match(/&hl=[^&]+/), b = r[0].match(/&start=\d+/), c = r[0].match(/&tbm=[^&]+/), d = r[0].match(/&tbs=[^&]+/); return r[1] + (r[2] ? r[2] : r[3]) + (a ? a : "") + (b ? b : "") + (c ? c : "") + (d ? d : ""); }, regex: true, },{ name: "google搜索结果禁止跳转", from: /^https?:\/\/www.google..{2,6}\/url\?.url=([^&])./i, to: "$1", regex: true, decode: true },{ name: "google图片搜索结果禁止跳转", from: /^https?:\/\/www.google..{2,6}\/imgres\?.imgurl=([^&])./i, to: "$1", regex: true, decode: true },{ name: "ssl google搜索禁止跳转", from: /^https?:\/\/encrypted.google..{2,6}\/url\?.url=([^&])./i, to: "$1", regex: true, decode: true },{ name: "gmail邮箱链接跳转", from: /^https?:\/\/www.google..{2,6}\/url.(\?q|&q)=(http[^&]+)./i, to: "$2", regex: true, //decode: true },{ name: "google搜索首页跳转", from: /^(https?:\/\/www.google..{2,6})\/webhp.+/i, to: "$1", regex: true },{ name: "google图片搜索首页跳转", from: /^(https?:\/\/www.google..{2,6}\/)(imghp.sbi=1|imghp(?!.sbi=1)).+/i, to: "$1$2", regex: true },{ name: "谷歌香港转简中结果", from: /^(https?:\/\/www.google.com).hk\/search\?(.)/i, to: "$1/search?$2&hl=zh-CN", regex: true },{ name: "关闭谷歌安全搜索", from: /^(https?:\/\/www.google.com\/search\?(?!.&safe=off$).)/i, to: "$1&safe=off", regex: true },{ name: "谷歌搜索危险结果", from: /^https?:\/\/www.google..{2,6}\/interstitial.url=(.)/i, to: "$1", regex: true },{ name: "谷歌镜像访问", from: /^https?:\/\/www.google..{2,6}(\/.)/i, to: "https://a.gufen.gq$1", regex: true, state: false //找不到可用镜像站 },{ name: "谷歌搜索转https", from: /^http:\/\/(www.google..{2,6}\/.)/i, to: "https://$1", regex: true },{ name: "谷歌快照转https", from: /^http:\/\/(webcache.googleusercontent.com\/.)/i, to: "https://$1", regex: true },{ name: "谷歌图书转com", from: /^(https?:\/\/books.google.)cn(.)/i, to: "$1com$2", regex: true },{ name: "谷歌翻译转cn", from: /^https?:\/\/(translate.google.)(?!cn).{2,6}(\/.)/i, to: "https://$1cn$2", regex: true }, //百度系 { name: "百度搜索去多余参数", from: /^https?:\/\/(www.baidu.com\/)(s|baidu)\?.((wd=.&pn=[^&]+)|(wd=[^&]+(?!&pn.)))&(?!ie).+/i, to: "https://$1s?$3&ie=utf-8", regex: true },{ name: "百度随身听(音质改320)", from: /^http:\/\/music.baidu.com\/data\/music\/fmlink(.[&\?])rate=[^3]\d+(.)/i, to: "http://music.baidu.com/data/music/fmlink$1rate=320$2", regex: true },{ name: "贴吧图片大图", from: /^(http:\/\/imgsrc.baidu.com\/forum\/)w.\/sign=.(\/\w+.jpg)/i, to: "$1pic/item$2", regex: true },{ name: "贴吧域名重定向", from: /^http:\/\/([a-z].tieba|xingqu)(.baidu.com\/)(p\/|f.kw=|f.ct|f.kz=)(.)/i, to: "http://tieba$2$3$4", regex: true },{ name: "贴吧蓝字转百科", from: /^https?:\/\/([\u4e00-\u9fa5]+)\/?$/i, to: "http://baike.baidu.com/item/$1", regex: true },{ name: "手机贴吧列表页转电脑版", from: /^http:\/\/.?tieba.baidu.com\/mo\/.?\/.{4}=(?!\d+)([^&])./i, to: "http://tieba.baidu.com/f?kw=$1", regex: true },{ name: "手机贴吧内容页转电脑版", from: /^http:\/\/.?tieba.baidu.com\/mo\/.?\/.{4}=(\d+)&./i, to: "http://tieba.baidu.com/p/$1", regex: true },{ name: "百度网盘转https", from: /^http:\/\/(pan|yun).baidu.com\/(disk|s|share)\/(.)/i, to: 'https://pan.baidu.com/$2/$3', regex: true },{ name: "百度盘wap/link >> share/link", from: /^https?:\/\/(pan|yun).baidu.com\/wap\/(link\?|shareview\?\&)(.)/i, to: 'https://pan.baidu.com/share/link?$3', regex: true },{ name: "百度盘wap/album/file >> pcloud/album/file", from: /^https?:\/\/(pan|yun).baidu.com\/wap\/album\/file(.)/i, to: 'https://pan.baidu.com/pcloud/album/file$2', regex: true },{ name: "百度盘wap/share/home >> share/home", from: /^https?:\/\/(pan|yun).baidu.com\/wap\/share\/(home\?|)(.)/i, to: 'https://pan.baidu.com/share/home?$3', regex: true }, //特殊功能 { name: "网易云播放页重定向", from: /^(https?:\/\/music.163.com\/#\/song)(\/|\?id=)(\d+).+/i, exclude: /\?id=\d+$/i, to: "$1?id=$3", regex: true },{ name: "进入微博主页热门转全部", from: /^(https?:\/\/.weibo.com\/([\w%]+|u\/[0-9]+|n\/[\w%]+))($|\?.refer_flag=.+?$|\?from=feed.$|\?topnav.$)/i, exclude: /is_hot=1$/, to: "$1?is_all=1#_0", regex: true },{ name: "sourceforge直接下载", from: /https:\/\/sourceforge.net\/projects\/(\w.)\/files\/(.)\/download/i, to: "https://excellmedia.dl.sourceforge.net/project/$1/$2", regex: true },{ name: "反Google搜索人机验证", from: /^https?:\/\/ipv4.google.com\/sorry\/index(?:Redirect|)\?continue=https?.?((q=.)&q=.|(tbs=.))/i, to: "https://www.google.com/search?$2$3", regex: true, decode: true },{ name: "天使动漫直接打工", from: /^(http:\/\/www.tsdm.{3})\/forum.php\?mod=viewthread&tid=321479/i, to: "$1/plugin.php?id=np_cliworkdz:work", regex: true },{ name: "哔哩哔哩番剧播放器宽屏", from: /(https:\/\/www.bilibili.com\/blackboard\/html5player.html\?cid=.)/i, exclude: /as_wide/, to: "$1&as_wide=1", regex: true },{ name: "风之动漫钓鱼跳转", from: /^http:\/\/manhua.fzdm.com(.)/i, to: "http://www.fzdm.com/manhua$1", regex: true },{ name: "Stylish查找当前网站样式链接修改", from: /^https:\/\/userstyles.org\/styles\/browse\?category=(.)/i, to: "https://userstyles.org/styles/browse/$1", regex: true },{ name: "样式站预览图转原图", from: /^(https:\/\/userstyles.org\/style_screenshot)_thumbnail(s\/.)/i, to: "$1$2", regex: true },{ name: "Discuz!X2转完整版", from: /^(https?:\/\/.\/)archiver\/\?tid-(.).html./i, to: "$1forum.php?mod=viewthread&tid=$2", regex: true },{ name: "Discuz!X3转完整版", from: /^(https?:\/\/.\/)archiver\/tid-(.).html./i, to: "$1thread-$2-1-1.html", regex: true },{ name: "脚本链接二级转用户页,三级转项目页", from: /^https?:\/\/raw.(github)usercontent(.com\/\w+)(\/?|\/\w+\/?)$/i, to: "https://$1$2$3", regex: true },{ name: "图站图片短链接", from: /^https?:\/\/(files.(yande.re\/(image|sample)\/\w+\/).+|(konachan.com\/(image|sample)\/\w+)\/.+)..(.)/i, to: "https://$2$4\.$6", regex: true },{ name: "优酷网页去后缀", from: /^(https?:\/\/\w+.youku.com\/.)\?(spm|from)=./i, to: "$1", regex: true },{ name: "今日头条去后缀", from: /^(https?:\/\/www.toutiao.com\/(a|i)(\d+)\/)\?./i, to: "$1", regex: true },{ name: "汤不热改子域名", from: /(^https?:\/\/)(41|65|67)(.media.tumblr.com\/.)/i, to: "$168$3", regex: true },{ name: "知乎首页注册转登陆", from: /(^https?:\/\/www.zhihu.com\/)$/i, to: "$1#signin", regex: true },

sylingd commented 7 years ago

选择完整的JS文件,你贴出来的东西语法错误,JS无法解析!