打开/关闭搜索
搜索
打开/关闭菜单
1.5K
13.7K
101
37.6K
Cookie☆Wiki
导航
首页
alt-z
最近更改
alt-r
随机页面
alt-x
帮助
沙盒
特殊页面
alt-q
上传文件
alt-u
常用
曲奇简介
用语列表
人物一览
曲奇团体
曲奇年表
本篇列表
榜单列表
专辑列表
创作
音MAD
曲奇静画
曲奇实况
曲奇素材
BB剧场
漫画
同人游戏
曲奇实况
与曲奇有交集的内容
淫梦
东方Project
漫画日本昔话
biim兄贵致敬
QVC福岛
哲♂学
创价
YouTuber
恒心教
VOCALOID
运营批判
友情链接
Cookie☆贴吧
真夏夜的银梦贴吧
中文音MAD维基
潮学维基
银饼视频搜索站
中文曲奇维基Fandom站[已弃用]
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
alt-o
查看“︁用户:UnownHearn/common.js”︁的源代码
查看
阅读
查看源代码
查看历史
associated-pages
用户页
讨论
更多操作
←
用户:UnownHearn/common.js
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您没有权限编辑此JavaScript页面,因为此页面包含另一位用户的个人设置。
您可以查看和复制此页面的源代码。
高级
特殊字符
帮助
标题
2级
3级
4级
5级
格式
插入
拉丁字母
扩展拉丁字母
国际音标
符号
希腊字母
希腊字母扩展
西里尔字母
阿拉伯字母
扩展阿拉伯字母
希伯来字母
孟加拉语字符集
泰米尔数字和符号
泰卢固语字符集
僧伽罗语字符集
梵文字符集
古吉拉特语字符集
泰语字符集
老挝语
高棉语字母
加拿大原住民音节文字
卢恩
Á
á
À
à
Â
â
Ä
ä
Ã
ã
Ǎ
ǎ
Ā
ā
Ă
ă
Ą
ą
Å
å
Ć
ć
Ĉ
ĉ
Ç
ç
Č
č
Ċ
ċ
Đ
đ
Ď
ď
É
é
È
è
Ê
ê
Ë
ë
Ě
ě
Ē
ē
Ĕ
ĕ
Ė
ė
Ę
ę
Ĝ
ĝ
Ģ
ģ
Ğ
ğ
Ġ
ġ
Ĥ
ĥ
Ħ
ħ
Í
í
Ì
ì
Î
î
Ï
ï
Ĩ
ĩ
Ǐ
ǐ
Ī
ī
Ĭ
ĭ
İ
ı
Į
į
Ĵ
ĵ
Ķ
ķ
Ĺ
ĺ
Ļ
ļ
Ľ
ľ
Ł
ł
Ń
ń
Ñ
ñ
Ņ
ņ
Ň
ň
Ó
ó
Ò
ò
Ô
ô
Ö
ö
Õ
õ
Ǒ
ǒ
Ō
ō
Ŏ
ŏ
Ǫ
ǫ
Ő
ő
Ŕ
ŕ
Ŗ
ŗ
Ř
ř
Ś
ś
Ŝ
ŝ
Ş
ş
Š
š
Ș
ș
Ț
ț
Ť
ť
Ú
ú
Ù
ù
Û
û
Ü
ü
Ũ
ũ
Ů
ů
Ǔ
ǔ
Ū
ū
ǖ
ǘ
ǚ
ǜ
Ŭ
ŭ
Ų
ų
Ű
ű
Ŵ
ŵ
Ý
ý
Ŷ
ŷ
Ÿ
ÿ
Ȳ
ȳ
Ź
ź
Ž
ž
Ż
ż
Æ
æ
Ǣ
ǣ
Ø
ø
Œ
œ
ß
Ð
ð
Þ
þ
Ə
ə
格式
链接
标题
列表
文件
参考
讨论
说明
输入内容
输出结果
斜体
''斜体文字''
斜体文字
粗体
'''粗体文字'''
粗体文字
粗斜体
'''''粗斜体文字'''''
粗斜体文字
"use strict"; /** * 在鼠标移至文本与标题不同的 wikilink 上时, 弹出带有原标题的 popup * @author [[User:UnownHearn]] * @version 1 (2018/07/28) */ (function () { // https://stackoverflow.com/questions/14346414/how-do-you-do-html-encode-using-javascript function htmlEncode(value) { //create a in-memory div, set it's inner text(which jQuery automatically encodes) //then grab the encoded contents back out. The div never exists on the page. return $('<div/>').text(value).html(); } $(".WikiaArticle a[title]").hover(function () { if (this.className != "") { return; } // 作为 wikilink 的超链接没有 class var a = $(this); var title = a.attr("title"); if (title != a.text()) { a.append($('<span class="wikilink-popup">' + htmlEncode(title) + '</span>')); } }, function () { $(this).find(".wikilink-popup").remove(); }); })(); /** * 自动转换链接 * @author [[User:UnownHearn]] * @version 1.7 (2019/03/23) */ (function () { var rules = [{ // 两字母 + 一串数字 regex: /[a-zA-Z]{2}\d+/, link: function (text) { var base; switch (text.slice(0, 2)) { // niconico 主要 case "sm": case "nm": base = "https://www.nicovideo.jp/watch/"; break; case "im": base = "https://seiga.nicovideo.jp/seiga/"; break; // bilibili case "av": base = "https://www.bilibili.com/video/"; break; case "cv": /*专栏*/ base = "https://www.bilibili.com/read/"; break; case "am": /*音频*/ base = "https://www.bilibili.com/audio/"; break; // acfun case "ac": base = "http://www.acfun.cn/v/"; break; // niconico 其他, 参考: https://dic.nicovideo.jp/a/nico.ms case "sg": case "mg": case "bk": /*静画*/ base = "https://seiga.nicovideo.jp/watch/"; break; case "lv": /*生放送*/ base = "https://live.nicovideo.jp/watch/"; break; /* l/co 略去 */ case "co": /*社区*/ base = "https://com.nicovideo.jp/community/"; break; case "ch": /*频道*/ base = "https://ch.nicovideo.jp/channel/"; break; case "ar": /*频道文章*/ base = "https://ch.nicovideo.jp/article/"; break; case "nd": /*直贩*/ base = "https://chokuhan.nicovideo.jp/products/detail/"; break; /* 市场略去 */ case "ap": /*应用*/ base = "https://app.nicovideo.jp/app/"; break; case "jk": /*实况*/ base = "https://jk.nicovideo.jp/watch/"; break; case "nc": /*共有*/ base = "https://www.niconicommons.jp/material/"; break; case "nw": /*新闻*/ base = "https://news.nicovideo.jp/watch/"; break; } if (base !== undefined) { return base + text; } return null; } }, { // niconico mylist/ 及 user/ regex: /(mylist|user)\/\d+/, link: "https://www.nicovideo.jp/{}" }]; // generate url link for given `text` with the given `rule` (E.g. "sm3777" => "https://nicovideo.jp/watch/sm3777") function generateLink(rule, linkableText) { if (typeof rule.link === "function") { var link = rule.link(linkableText); if (link !== null && typeof link !== "string") { throw "The return value of link() must be either a string or null!"; } return link; } else { return rule.link.replace("{}", linkableText); } } // create an <a>nchor element with given url `link` and `text` // // the returned element only has a text node as its child function createAnchorElement(link, text) { return $("<a/>").addClass("autolink").attr("href", link).text(text).get(0); // var a = document.createElement("a"); // a.className = "autolink"; // a.href = link; // a.textContent = text; // return a; } // try detaching a linkable text from given `text` with given `rules` // // If a rule matches, it will return a tuple contains: // text before the linkable text, <a>nchor element that represents the linkable text (or a text node), text after the linkable text; // Otherwise, it will return a tuple contains: "", null, and the original text. function detachLinkableText(text, rules) { for (var ruleIndex in rules) { var rule = rules[ruleIndex]; var match = rule.regex.exec(text); if (match != null) { var textBefore = text.slice(0, match.index); var linkableText = match[0]; var remainText = text.slice(match.index + linkableText.length); var link = generateLink(rule, linkableText); if (link == null) { return [textBefore, document.createTextNode(linkableText), remainText]; } return [textBefore, createAnchorElement(link, linkableText), remainText]; } } return ["", null, text]; } function main() { var foundTextNodes = []; { //< put all text nodes that under `.WikiaArticle` elements but not under `a` or `.no-autolink` elements into `foundTextNodes` var articles = document.getElementsByClassName("WikiaArticle"); var filter = (function (node) { if (node.nodeType == 3 /* TEXT_NODE */) { return NodeFilter.FILTER_ACCEPT; } else if (node.nodeType != 1 /* ELEMENT_NODE */ || node.tagName.toLowerCase() == "a" || node.classList.contains("no-autolink")) { return NodeFilter.FILTER_REJECT; } return NodeFilter.FILTER_SKIP; }) Array.prototype.forEach.call(articles, function (article) { var walker = document.createTreeWalker(article, NodeFilter.SHOW_ALL, { acceptNode: filter }); while (walker.nextNode()) { foundTextNodes.push(walker.currentNode); } }) } for (var nodeIndex in foundTextNodes) { var foundTextNode = foundTextNodes[nodeIndex]; var remainText = foundTextNode.textContent; // this array will only contain text nodes and <a>nchor element nodes that have text nodes var nodes = []; while (true) { var _remainText = remainText; var rets = detachLinkableText(remainText, rules); var textBefore = rets[0]; var elem = rets[1]; remainText = rets[2]; if (elem === null) { // no rule matches break; } if (textBefore !== "") { nodes.push(document.createTextNode(textBefore)); } nodes.push(elem); if (_remainText === remainText) { throw "Infinite Loop!" } } if (nodes.length !== 0) { //< check if need to replace the original node nodes.push(document.createTextNode(remainText)); $(foundTextNode).replaceWith(nodes); } } } main(); })();
返回
用户:UnownHearn/common.js
。