├── .gitignore ├── ETTWikiHelper-TagEditer.user.js ├── ETTWikiHelper-Thumbnail.user.js ├── EhTagBuilder.user.js ├── EhTagSyringe.user.js ├── LICENSE ├── README.md └── template ├── ets-builder-menu.html ├── ets-prompt.html └── ui-translate.css /.gitignore: -------------------------------------------------------------------------------- 1 | /*.ico 2 | /angular.min.js 3 | /ets-builder-menu.html 4 | /ets-prompt.html 5 | /ui-translate.css -------------------------------------------------------------------------------- /ETTWikiHelper-TagEditer.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name ETTWikiHelper-TagEditer 3 | // @name:zh-CN E绅士标签翻译辅助工具-标签编辑 4 | // @namespace http://www.mapaler.com/ 5 | // @description Help to edit the gallery's tags. 6 | // @description:zh-CN 辅助编辑画廊的标签 7 | // @include /^https?://(exhentai\.org|e-hentai\.org)/g/\d+/\w+/.*$/ 8 | // @version 1.4.2 9 | // @author Mapaler 10 | // @copyright 2019+, Mapaler 11 | // @grant GM_registerMenuCommand 12 | // @grant GM_getValue 13 | // @grant GM_setValue 14 | // @grant GM_deleteValue 15 | // ==/UserScript== 16 | 17 | var lang = (navigator.language||navigator.userLanguage).replace("-","_"); //获取浏览器语言 18 | var scriptVersion = "unknown"; //本程序的版本 19 | var scriptName = "ETTWikiHelper-TagEditer"; //本程序的名称 20 | if (typeof(GM_info)!="undefined") 21 | { 22 | scriptVersion = GM_info.script.version.replace(/(^\s*)|(\s*$)/g, ""); 23 | if (GM_info.script.name_i18n) 24 | { 25 | var i18n = (navigator.language||navigator.userLanguage).replace("-","_"); //获取浏览器语言 26 | scriptName = GM_info.script.name_i18n[i18n]; //支持Tampermonkey 27 | } 28 | else 29 | { 30 | scriptName = GM_info.script.localizedName || //支持Greasemonkey 油猴子 3.x 31 | GM_info.script.name; //支持Violentmonkey 暴力猴 32 | } 33 | } 34 | 35 | //限定数值最大最小值 36 | function limitMaxAndMin(num,max,min) 37 | { 38 | if (num>max) return max; 39 | else if (num< min) return min; 40 | else return num; 41 | } 42 | 43 | //默认CSS内容 44 | var ewh_tag_styleText_Default = ` 45 | /* fallback */ 46 | @font-face { 47 | font-family: 'Material Icons'; 48 | font-style: normal; 49 | font-weight: 400; 50 | src: url(https://fonts.gstatic.com/s/materialicons/v47/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2'); 51 | } 52 | 53 | .material-icons { 54 | font-family: 'Material Icons'; 55 | font-weight: normal; 56 | font-style: normal; 57 | line-height: 1; 58 | letter-spacing: normal; 59 | text-transform: none; 60 | display: inline-block; 61 | white-space: nowrap; 62 | word-wrap: normal; 63 | direction: ltr; 64 | -moz-font-feature-settings: 'liga'; 65 | -moz-osx-font-smoothing: grayscale; 66 | } 67 | 68 | #gd4.ewh-float { /*浮动窗体*/ 69 | position: fixed; 70 | top: 10%; 71 | left: 10%; 72 | background-color : inherit; 73 | margin: 0 !important; 74 | padding: 0 !important; 75 | border-style: ridge; 76 | border-width: 3px; 77 | border-color: #eee black black #eee; 78 | opacity: 0.8; 79 | } 80 | .ewh-bar-floatcaption { /*标题栏整体*/ 81 | height: 22px; 82 | position: relative; 83 | } 84 | .ewh-cpttext-box { /*标题栏文字框*/ 85 | width: 100%; 86 | height: 100%; 87 | float: left; 88 | color: white; 89 | line-height: 22px; 90 | font-size: 14px; 91 | background-image: linear-gradient(to right,#808080,#B7B5BB); 92 | } 93 | .ewh-float .ewh-cpttext-box { /*浮动时的标题颜色*/ 94 | background-image: linear-gradient(to right,#000280,#0F80CD); 95 | } 96 | .ewh-cpttext-box::before{ /*标题图标*/ 97 | content: "🏷️"; 98 | } 99 | .ewh-cpttext-box span { /*标题文字*/ 100 | pointer-events:none; 101 | user-select: none; 102 | } 103 | .ewh-cptbtn-box { /*标题按钮框*/ 104 | height: 100%; 105 | position: absolute; 106 | top: 0; 107 | right: 8px; 108 | line-height: 22px; 109 | } 110 | .ewh-cpt-btn { /*平时的按钮*/ 111 | vertical-align: middle; 112 | padding: 0; 113 | font-size: 14px; 114 | margin-top:-2px; 115 | height: 18px; 116 | width: 20px; 117 | background-color: #c0c0c0; 118 | border-style: outset; 119 | border-width: 2px; 120 | border-color: white black black white; 121 | } 122 | .ewh-cpt-rag { /*平时的范围拖动条*/ 123 | vertical-align: middle; 124 | padding: 0; 125 | font-size: 14px; 126 | margin-top:0; 127 | height: 18px; 128 | width: 100px; 129 | } 130 | .ewh-cpt-btn:active { /*按钮按下时的凹陷*/ 131 | background-color: #d8d8d8; 132 | padding-left: 1px !important; 133 | padding-top: 1px !important; 134 | border-style: inset; 135 | border-color: black white white black; 136 | } 137 | .ewh-cpt-btn:focus { /*激活后的虚线*/ 138 | outline: dotted 1px black; 139 | } 140 | .ewh-btn-closefloat,.ewh-rag-opacity { /*平时隐藏关闭浮动的按钮*/ 141 | display: none; 142 | } 143 | .ewh-float .ewh-btn-closefloat,.ewh-float .ewh-rag-opacity { /*浮动时显示关闭浮动的按钮*/ 144 | display: unset; 145 | } 146 | .ewh-float .ewh-btn-openfloat{ /*浮动时隐藏开启浮动的按钮*/ 147 | display: none; 148 | } 149 | .ewh-bar-tagsearch{ 150 | position: relative; 151 | } 152 | .ewh-ipt-tagsearch{ 153 | width: 200px; 154 | box-sizing: border-box; 155 | } 156 | .ewh-tagsearchtext,.ewh-tagsearchlink{ 157 | font-size: 10pt; 158 | } 159 | .ewh-bar-tagsearch a::before{ 160 | font-size: 10pt; 161 | font-weight: bold; 162 | } 163 | .ewh-bar-tagsearch a::after{ 164 | font-size: 10pt; 165 | background: #c0c0c0; 166 | color:black; 167 | border-style: ridge; 168 | border-width: 3px; 169 | border-color: #eee black black #eee; 170 | position:absolute; 171 | z-index:999; 172 | padding:8px; 173 | min-width:150px; 174 | max-width:500px; 175 | white-space:pre-wrap; 176 | opacity: 0; 177 | transition: opacity 0.1s; 178 | top:28px; 179 | left:45%; 180 | pointer-events:none; 181 | font-weight: 400; 182 | line-height: 20px; 183 | } 184 | .ewh-bar-tagsearch a:hover::after{ 185 | opacity: 1; 186 | } 187 | `; 188 | //获取Tag编辑区 189 | var ewhWindow = document.querySelector("#gd4"); 190 | 191 | //增加浮动窗标题栏 192 | var divCaptionBar = ewhWindow.insertBefore(document.createElement("div"),gd4.firstChild); 193 | divCaptionBar.className = "ewh-bar-floatcaption"; 194 | 195 | //生成辅助器CSS 196 | var ewh_tag_style = divCaptionBar.appendChild(document.createElement("style")); 197 | ewh_tag_style.type = "text/css"; 198 | ewh_tag_style.appendChild(document.createTextNode(ewh_tag_styleText_Default)); 199 | 200 | //生成标题栏文字 201 | var divCaption = divCaptionBar.appendChild(document.createElement("div")); 202 | divCaption.className = "ewh-cpttext-box"; 203 | divCaption.appendChild(document.createElement("span")).appendChild(document.createTextNode(scriptName)); 204 | 205 | //添加窗体鼠标拖拽移动 206 | var windowPosition = ewhWindow.position = [0, 0]; //[X,Y] 用以储存窗体开始拖动时的鼠标相对窗口坐标差值。 207 | divCaption.addEventListener("mousedown", function(e) { //按下鼠标则添加移动事件 208 | if (!ewhWindow.classList.contains("ewh-float")) return; //如果不是浮动窗体直接结束 209 | var eX = limitMaxAndMin(e.clientX,document.documentElement.clientWidth,0), eY = limitMaxAndMin(e.clientY,document.documentElement.clientHeight,0); //不允许鼠标超出网页。 210 | windowPosition[0] = eX - ewhWindow.offsetLeft; 211 | windowPosition[1] = eY - ewhWindow.offsetTop; 212 | var handler_mousemove = function(e) { //移动鼠标则修改窗体坐标 213 | var eX = limitMaxAndMin(e.clientX,document.documentElement.clientWidth,0), eY = limitMaxAndMin(e.clientY,document.documentElement.clientHeight,0); //不允许鼠标超出网页。 214 | ewhWindow.style.left = (eX - windowPosition[0]) + 'px'; 215 | ewhWindow.style.top = (eY - windowPosition[1]) + 'px'; 216 | }; 217 | var handler_mouseup = function(e) { //抬起鼠标则取消移动事件 218 | document.removeEventListener("mousemove", handler_mousemove); 219 | if (ewhWindow.style.left) GM_setValue("floatwindow-left",ewhWindow.style.left); //储存窗体位置 220 | if (ewhWindow.style.top) GM_setValue("floatwindow-top",ewhWindow.style.top); //储存窗体位置 221 | 222 | }; 223 | document.addEventListener("mousemove", handler_mousemove); 224 | document.addEventListener("mouseup", handler_mouseup, { once: true }); 225 | }); 226 | 227 | //生成标题栏按钮 228 | var divButtonBox = divCaptionBar.appendChild(document.createElement("div")); 229 | divButtonBox.className = "ewh-cptbtn-box"; 230 | 231 | //生成修改设置的按钮 232 | var ragOpacity = divButtonBox.appendChild(document.createElement("input")); 233 | ragOpacity.className = "ewh-cpt-rag ewh-rag-opacity"; 234 | ragOpacity.type = "range"; 235 | ragOpacity.max = 1; 236 | ragOpacity.min = 0.5; 237 | ragOpacity.step = 0.01; 238 | ragOpacity.title = "窗体不透明度"; 239 | ragOpacity.onchange = ragOpacity.oninput = function(){ 240 | ewhWindow.style.opacity = this.value; 241 | }; 242 | ragOpacity.onchange = function(){ 243 | ragOpacity.oninput(); 244 | if (ewhWindow.style.opacity) GM_setValue("floatwindow-opacity",ewhWindow.style.opacity); //储存窗体透明度 245 | }; 246 | 247 | //生成打开浮动状态的按钮 248 | var btnOpenFloat = divButtonBox.appendChild(document.createElement("button")); 249 | btnOpenFloat.className = "ewh-cpt-btn material-icons ewh-btn-openfloat"; 250 | btnOpenFloat.title = "浮动标签编辑框"; 251 | btnOpenFloat.appendChild(document.createElement("span").appendChild(document.createTextNode("open_in_new"))); 252 | btnOpenFloat.onclick = function(){ 253 | //ewhWindow.setAttribute("style",ewhWindow.getAttribute("style_bak")); 254 | //ewhWindow.removeAttribute("style_bak"); 255 | ewhWindow.classList.add("ewh-float"); 256 | ewhWindow.style.left = GM_getValue("floatwindow-left"); 257 | ewhWindow.style.top = GM_getValue("floatwindow-top"); 258 | ewhWindow.style.opacity = ragOpacity.value = GM_getValue("floatwindow-opacity") || 0.8; 259 | }; 260 | GM_registerMenuCommand("打开浮动标签编辑框", btnOpenFloat.onclick); 261 | 262 | //生成关闭浮动状态的按钮 263 | var btnCloseFloat = divButtonBox.appendChild(document.createElement("button")); 264 | btnCloseFloat.className = "ewh-cpt-btn material-icons ewh-btn-closefloat"; 265 | btnCloseFloat.title = "关闭浮动窗体"; 266 | btnCloseFloat.appendChild(document.createElement("span").appendChild(document.createTextNode("close"))); 267 | btnCloseFloat.onclick = function(){ 268 | //ewhWindow.setAttribute("style_bak",ewhWindow.getAttribute("style")); 269 | if (ewhWindow.style.left) GM_setValue("floatwindow-left",ewhWindow.style.left); //储存窗体位置 270 | if (ewhWindow.style.top) GM_setValue("floatwindow-top",ewhWindow.style.top); //储存窗体位置 271 | if (ewhWindow.style.opacity) GM_setValue("floatwindow-opacity",ewhWindow.style.opacity); //储存窗体透明度 272 | ewhWindow.removeAttribute("style"); 273 | ewhWindow.classList.remove("ewh-float"); 274 | }; 275 | GM_registerMenuCommand("重置浮动窗位置与透明度", function(){ 276 | btnCloseFloat.onclick(); //先关掉窗体,然后删除设置 277 | GM_deleteValue("floatwindow-left"); 278 | GM_deleteValue("floatwindow-top"); 279 | GM_deleteValue("floatwindow-opacity"); 280 | }); 281 | 282 | //获取标签数据列表 283 | var tagdatalist = document.querySelector("#tbs-tags"); 284 | //获取真实标签输入框 285 | var newTagText = document.querySelector("#newtagfield"); 286 | if (!tagdatalist) //没有ETS,但有ETS扩展版的处理方式 287 | { 288 | var tagDataStr = localStorage.getItem("EhSyringe.tag-list"); //ETS扩展版1.2.1的数据 289 | if (typeof(tagDataStr) == "string") 290 | { 291 | var nameSpaceC = { 292 | artist:"艺术家", 293 | female:"女性", 294 | male:"男性", 295 | parody:"原作", 296 | character:"角色", 297 | group:"团队", 298 | language:"语言", 299 | reclass:"重新分类", 300 | misc:"杂项" 301 | }; 302 | var tagData = JSON.parse(tagDataStr); 303 | var tagdatalist = document.createElement("datalist"); 304 | tagdatalist.id = "tbs-tags"; 305 | newTagText.setAttribute("list","tbs-tags"); 306 | tagData.forEach(function(tag){ 307 | tagdatalist.appendChild(new Option(nameSpaceC[tag.namespace]+":"+tag.name,tag.search)); 308 | }) 309 | newTagText.insertAdjacentElement('afterend',tagdatalist); 310 | } 311 | } 312 | if (tagdatalist) //如果存在则生成标签搜索框 313 | { 314 | var taglist = tagdatalist.options; 315 | //增加标签搜索框箱子 316 | var divSearchBar = ewhWindow.insertBefore(document.createElement("div"),document.querySelector("#tagmenu_act")); 317 | divSearchBar.className = "ewh-bar-tagsearch"; 318 | 319 | //增加标签搜索框 320 | var iptTagSearch = divSearchBar.appendChild(document.createElement("input")); 321 | iptTagSearch.type = "text"; 322 | iptTagSearch.placeholder = "🔍标签搜索:回车附加到下方▼"; 323 | iptTagSearch.setAttribute("list","tbs-tags"); 324 | iptTagSearch.className="ewh-ipt-tagsearch"; 325 | //增加标签搜索提醒文字 326 | var spnTagSearchInfo = divSearchBar.appendChild(document.createElement("span")); 327 | spnTagSearchInfo.className="ewh-tagsearchtext"; 328 | //增加标签搜索提醒标签 329 | var aTagSearchInfo = divSearchBar.appendChild(document.createElement("a")); 330 | aTagSearchInfo.className="ewh-tagsearchlink"; 331 | 332 | iptTagSearch.onkeypress = function(e){ 333 | if(e.keyCode==13){ //回车,将内容附加到真实Tag框,并清空搜索框 334 | if (this.value == 0) 335 | { //如果什么都没输入 336 | spnTagSearchInfo.innerHTML = ""; 337 | aTagSearchInfo.removeAttribute("id"); 338 | aTagSearchInfo.innerHTML = ""; 339 | if (newTagText.value.length > 0)tag_from_field(); //如果输入框有内容点击Tag提交 340 | return; 341 | }; 342 | var clabel = false, useGuess = false, guess = false; 343 | if (this.value.replace(/[\w\:\"\s\-\.\'\$]/,"").length>0) useGuess = true; //如果存在非tag字符,则尝试搜索中文。 344 | for (var ti=0;ti0) 351 | { 352 | clabel = taglist[ti].label; 353 | guess = true; //标记为猜的 354 | this.value = taglist[ti].value; //目前的输入修改为猜的tag 355 | break; 356 | } 357 | } 358 | if (clabel) 359 | { 360 | var regArr = /^(\w+):"?([\w+\s\-\'\.]+)\$?"?$/ig.exec(this.value); 361 | var shortTag = (regArr[1]=="misc"?"":(regArr[1].substr(0,1) + ":")) + regArr[2]; //缩减Tag长度,以便一次能多提交一些Tag 362 | if ((newTagText.value+","+shortTag).length>200) 363 | { 364 | spnTagSearchInfo.innerHTML = "⛔超长(原始标签输入框限定200字符)"; 365 | aTagSearchInfo.removeAttribute("id"); 366 | aTagSearchInfo.innerHTML = ""; 367 | }else 368 | { 369 | newTagText.value = (newTagText.value.length>0)?(newTagText.value+","+shortTag):shortTag; 370 | spnTagSearchInfo.innerHTML = (guess?"程序猜测你想添加":"你添加了")+" " + (tagData?"":(clabel.split(":")[0] + ":")); 371 | aTagSearchInfo.id = "ta_" + (regArr[1]=="misc"?"":regArr[1]+":") + regArr[2].replace(/\s/igm,"_"); 372 | aTagSearchInfo.innerHTML = clabel; 373 | this.value = ""; 374 | } 375 | }else 376 | { 377 | spnTagSearchInfo.innerHTML = "☹️数据库里没有这个标签"; 378 | aTagSearchInfo.removeAttribute("id"); 379 | aTagSearchInfo.innerHTML = ""; 380 | } 381 | } 382 | }; 383 | } -------------------------------------------------------------------------------- /ETTWikiHelper-Thumbnail.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name ETTWikiHelper-Thumbnail 3 | // @name:zh-CN E绅士标签翻译辅助工具-缩略图 4 | // @namespace http://www.mapaler.com/ 5 | // @description Help to get thumbnail for write EhTagTranslator's wiki info. 6 | // @description:zh-CN 自动将E绅士大缩略图域名改为手机站域名,并可以一键复制各站点格式的缩略图。 7 | // @include /^https?://(exhentai\.org|e-hentai\.org)/$/ 8 | // @include /^https?://(exhentai\.org|e-hentai\.org)/g/\d+/\w+/.*$/ 9 | // @include /^https?://(exhentai\.org|e-hentai\.org)/(index\.php)?\?.*$/ 10 | // @include /^https?://(exhentai\.org|e-hentai\.org)/(tag|uploader)/.*$/ 11 | // @include /^https?://(exhentai\.org|e-hentai\.org)/(doujinshi|manga|artistcg|gamecg|western|non-h|imageset|cosplay|asianporn|misc).*$/ 12 | // @version 2.1.0 13 | // @grant GM_setClipboard 14 | // @author Mapaler 15 | // @copyright 2017+, Mapaler 16 | // ==/UserScript== 17 | 18 | //没有扩展时的debug 19 | if(typeof(GM_setClipboard) == "undefined") 20 | { 21 | var GM_setClipboard = function(str){ 22 | prompt(str,str); 23 | console.debug("使用GM_setClipboard,值为",str); 24 | } 25 | } 26 | 27 | //发送网页通知 28 | function spawnNotification(theBody, theIcon, theTitle) 29 | { 30 | var options = { 31 | body: theBody, 32 | icon: theIcon 33 | } 34 | if (!("Notification" in window)) 35 | { 36 | alert(theBody); 37 | } 38 | else if (Notification.permission === "granted") { 39 | Notification.requestPermission(function (permission) { 40 | // If the user is okay, let's create a notification 41 | var n = new Notification(theTitle, options); 42 | }); 43 | } 44 | // Otherwise, we need to ask the user for permission 45 | else if (Notification.permission !== 'denied') { 46 | Notification.requestPermission(function (permission) { 47 | // If the user is okay, let's create a notification 48 | if (permission === "granted") { 49 | var n = new Notification(theTitle, options); 50 | } 51 | }); 52 | } 53 | } 54 | 55 | var thumbnailPattern = "https?://(\\d+\\.\\d+\\.\\d+\\.\\d+|ul\\.ehgt\\.org|ehgt\\.org|exhentai\\.org)(?:/t)?/(\\w+)/(\\w+)/(\\w+)\-(\\d+)\-(\\d+)\-(\\d+)\-(\\w+)_(l|250).jpg"; //缩略图地址正则匹配式 56 | var gdtlObj = function(){ 57 | var obj = { 58 | dom:"", 59 | fullsrc:"", 60 | domain:"", 61 | path1:"", 62 | path2:"", 63 | hash1:"", 64 | hash2:"", 65 | width:"", 66 | height:"", 67 | extension:"", 68 | size:"", 69 | addImgFrom_gdtlDom: function(dom) 70 | { 71 | if (dom == undefined) dom = this.dom; 72 | else this.dom = dom; 73 | var img = dom.querySelector("img"); 74 | if (img == null) console.log(dom) 75 | var addsrc = this.addImgFromSrc(img.src); 76 | 77 | if (addsrc) 78 | return true; 79 | else 80 | return false; 81 | }, 82 | addImgFromSrc: function(src) 83 | { 84 | if (src == undefined) return false; 85 | this.fullsrc = src; 86 | var regSrc = new RegExp(thumbnailPattern, "ig"); 87 | var regResult = regSrc.exec(src); 88 | if (regResult) 89 | { 90 | this.domain = regResult[1]; 91 | this.path1 = regResult[2]; 92 | this.path2 = regResult[3]; 93 | this.hash1 = regResult[4]; 94 | this.hash2 = regResult[5]; 95 | this.width = regResult[6]; 96 | this.height = regResult[7]; 97 | this.extension = regResult[8]; 98 | this.size = regResult[9]; 99 | } 100 | return true; 101 | }, 102 | replaceImgSrcFrom_gdtlDom: function(dom,type) 103 | { 104 | if (dom == undefined) dom = this.dom; 105 | else this.dom = dom; 106 | var img = dom.getElementsByTagName("img")[0]; 107 | img.src = this.getSrc(type); 108 | }, 109 | getSrc: function() 110 | { 111 | var srcA = []; 112 | srcA.push(location.protocol,"//ehgt.org/",this.path1,"/",this.path2,"/",this.hash1,"-",this.hash2,"-",this.width,"-",this.height,"-",this.extension,"_",this.size,".jpg"); 113 | return srcA.join(""); 114 | }, 115 | addBtnList: function(dom) 116 | { 117 | if (dom == undefined) dom = this.dom; 118 | function creat_li(caption,href,type){ 119 | var li = document.createElement("li"); 120 | li.className = "EWHT-li"; 121 | var btn = document.createElement("button"); 122 | btn.className = "EWHT-btn"; 123 | btn.appendChild(document.createTextNode(caption)); 124 | btn.onclick = function(){ 125 | var str = href; 126 | var typeName = "单纯地址"; 127 | if (caption == "图") 128 | { 129 | str = "![图](" + href + ")"; 130 | typeName = "MD格式图片地址"; 131 | }else if (caption == "隐") 132 | { 133 | str = "![图](# \"" + href + "\")"; 134 | typeName = "R18 MD格式图片地址"; 135 | }else if (caption == "限") 136 | { 137 | str = "![图](## \"" + href + "\")"; 138 | typeName = "R18G限制级 MD格式图片地址"; 139 | } 140 | GM_setClipboard(str); 141 | spawnNotification(str,href,"已复制到剪贴板 - " + typeName); 142 | } 143 | 144 | li.appendChild(btn); 145 | return li 146 | } 147 | var ul = document.createElement("ul"); 148 | ul.className = "EWHT-ul"; 149 | ul.appendChild(creat_li("纯",this.getSrc())); 150 | ul.appendChild(creat_li("图",this.getSrc())); 151 | ul.appendChild(creat_li("隐",this.getSrc())); 152 | ul.appendChild(creat_li("限",this.getSrc())); 153 | dom.appendChild(ul); 154 | }, 155 | } 156 | return obj; 157 | } 158 | 159 | var style = document.createElement("style"); 160 | style.type = "text/css"; 161 | var styleTxt = [ 162 | //画廊缩略图 163 | ["#gdt .gdtl","{" 164 | ,[ 165 | ,"position:relative" 166 | ].join(';\r\n '),"}"].join('\r\n'), 167 | ["#gdt .EWHT-ul","{" 168 | ,[ 169 | ,"top:0px" 170 | ,"right:0px" 171 | ].join(';\r\n '),"}"].join('\r\n'), 172 | //画廊封面 173 | ["#gleft .EWHT-ul","{" 174 | ,[ 175 | ,"top:15px" 176 | ,"left:-5px" 177 | ].join(';\r\n '),"}"].join('\r\n'), 178 | //搜索列表 179 | [".itg .id1","{" 180 | ,[ 181 | ,"position:relative" 182 | ].join(';\r\n '),"}"].join('\r\n'), 183 | [".itg .EWHT-ul","{" 184 | ,[ 185 | ,"top:33px" 186 | ,"right:-5px" 187 | ].join(';\r\n '),"}"].join('\r\n'), 188 | //图片浏览页 189 | ["#i3","{" 190 | ,[ 191 | ,"position:relative" 192 | ].join(';\r\n '),"}"].join('\r\n'), 193 | ["#i3 .EWHT-ul","{" 194 | ,[ 195 | ,"top:-30px" 196 | ,"right:0px" 197 | ].join(';\r\n '),"}"].join('\r\n'), 198 | //通用 199 | [".EWHT-ul","{" 200 | ,[ 201 | ,"position:absolute" 202 | ,"list-style:none" 203 | ,"padding:0px" 204 | ,"margin:0px" 205 | ].join(';\r\n '),"}"].join('\r\n'), 206 | [".EWHT-ul .EWHT-btn","{" 207 | ,[ 208 | ,"padding:0px" 209 | ,"font-size:12px" 210 | ,"width:18px" 211 | ].join(';\r\n '),"}"].join('\r\n'), 212 | ].join('\r\n'); 213 | style.innerHTML = styleTxt; 214 | var head = document.head || document.querySelector('head'); 215 | head.appendChild(style); 216 | 217 | var gdt = document.querySelector("#gdt"); 218 | var itg = document.querySelector(".itg"); 219 | if (gdt) //画廊 220 | { 221 | var gdtls = gdt.getElementsByClassName("gdtl"); 222 | if (gdtls.length>0) 223 | { 224 | for (var gdi = 0,len= gdtls.length ; gdi 0) 244 | { 245 | for (var id1i = 0,len= id1s.length ; id1i 19 | // @copyright 2017+, Mapaler 20 | //-@grant GM_xmlhttpRequest 21 | //-@grant GM_getValue 22 | //-@grant GM_setValue 23 | //-@grant GM_deleteValue 24 | //-@grant GM_listValues 25 | // ==/UserScript== 26 | 27 | (function() { 28 | var newRe = location.pathname.indexOf("EhTagTranslation/Database")>=0; //是否已经迁移 29 | var wiki_URL= newRe ? //GitHub wiki 的地址 30 | "https://github.com/EhTagTranslation/Database/tree/master/" : //新的组织项目地址 31 | "https://github.com/Mapaler/EhTagTranslator/wiki"; //传统Wiki地址 32 | var wiki_version_filename = "version"; //版本的地址 33 | var rows_filename = newRe?"database/rows.md":"rows"; //行名的地址 34 | var buttonInserPlace = document.querySelector(".pagehead-actions"); //按钮插入位置 35 | var windowInserPlace = document.querySelector(".UnderlineNav"); //窗口插入位置 36 | var scriptVersion = "unknown"; //本程序的版本 37 | var scriptName = "EhTagBuilder"; //本程序的名称 38 | if (typeof(GM_info)!="undefined") 39 | { 40 | scriptVersion = GM_info.script.version.replace(/(^\s*)|(\s*$)/g, ""); 41 | if (GM_info.script.name_i18n) 42 | { 43 | var i18n = (navigator.language||navigator.userLanguage).replace("-","_"); //获取浏览器语言 44 | scriptName = GM_info.script.name_i18n[i18n]; //支持Tampermonkey 45 | } 46 | else 47 | { 48 | scriptName = GM_info.script.localizedName || //支持Greasemonkey 油猴子 3.x 49 | GM_info.script.name; //支持Violentmonkey 暴力猴 50 | } 51 | } 52 | var optionVersion = 1; //当前设置版本,用于提醒是否需要重置设置 53 | var database_structure_version = newRe?6:4; //当前数据库结构版本,用于提醒是否需要更新脚本 54 | var downOverCheckHook; //检测下载是否完成的循环函数 55 | var rowsCount = 0; //行名总数 56 | var rowsCurrent = 0; //当前下载行名 57 | //匹配Emoji正则表达式,Made by @xioxin 58 | var emojireg = /\u{2139}|[\u{2194}-\u{2199}]|[\u{21A9}-\u{21AA}]|[\u{231A}-\u{231B}]|\u{2328}|\u{23CF}|[\u{23E9}-\u{23F3}]|[\u{23F8}-\u{23FA}]|\u{24C2}|[\u{25AA}-\u{25AB}]|\u{25B6}|\u{25C0}|[\u{25FB}-\u{25FE}]|[\u{2600}-\u{2604}]|\u{260E}|\u{2611}|[\u{2614}-\u{2615}]|\u{2618}|\u{261D}|\u{2620}|[\u{2622}-\u{2623}]|\u{2626}|\u{262A}|[\u{262E}-\u{262F}]|[\u{2638}-\u{263A}]|[\u{2648}-\u{2653}]|\u{2660}|\u{2663}|\u{2666}|\u{2668}|\u{267B}|\u{267F}|[\u{2692}-\u{2697}]|\u{2699}|[\u{269B}-\u{269C}]|[\u{26A0}-\u{26A1}]|[\u{26AA}-\u{26AB}]|[\u{26B0}-\u{26B1}]|[\u{26BD}-\u{26BE}]|[\u{26C4}-\u{26C5}]|\u{26C8}|\u{26CE}|\u{26CF}|\u{26D1}|[\u{26D3}-\u{26D4}]|[\u{26E9}-\u{26EA}]|[\u{26F0}-\u{26F5}]|[\u{26F7}-\u{26FA}]|\u{26FD}|\u{2702}|\u{2705}|[\u{2708}-\u{2709}]|[\u{270A}-\u{270B}]|[\u{270C}-\u{270D}]|\u{270F}|\u{2712}|\u{2714}|\u{2716}|\u{271D}|\u{2721}|\u{2728}|[\u{2733}-\u{2734}]|\u{2744}|\u{2747}|\u{274C}|\u{274E}|[\u{2753}-\u{2755}]|\u{2757}|\u{2763}|[\u{2795}-\u{2797}]|\u{27A1}|\u{27B0}|\u{27BF}|[\u{2934}-\u{2935}]|[\u{2B05}-\u{2B07}]|[\u{2B1B}-\u{2B1C}]|\u{2B50}|\u{2B55}|\u{3030}|\u{303D}|\u{3297}|\u{3299}|\u{1F004}|\u{1F0CF}|[\u{1F170}-\u{1F171}]|\u{1F17E}|\u{1F17F}|\u{1F18E}|[\u{1F191}-\u{1F19A}]|[\u{1F1E6}-\u{1F1FF}]|[\u{1F201}-\u{1F202}]|\u{1F21A}|\u{1F22F}|[\u{1F232}-\u{1F23A}]|[\u{1F250}-\u{1F251}]|[\u{1F300}-\u{1F320}]|\u{1F321}|[\u{1F324}-\u{1F32C}]|[\u{1F32D}-\u{1F32F}]|[\u{1F330}-\u{1F335}]|\u{1F336}|[\u{1F337}-\u{1F37C}]|\u{1F37D}|[\u{1F37E}-\u{1F37F}]|[\u{1F380}-\u{1F393}]|[\u{1F396}-\u{1F397}]|[\u{1F399}-\u{1F39B}]|[\u{1F39E}-\u{1F39F}]|[\u{1F3A0}-\u{1F3C4}]|\u{1F3C5}|[\u{1F3C6}-\u{1F3CA}]|[\u{1F3CB}-\u{1F3CE}]|[\u{1F3CF}-\u{1F3D3}]|[\u{1F3D4}-\u{1F3DF}]|[\u{1F3E0}-\u{1F3F0}]|[\u{1F3F3}-\u{1F3F5}]|\u{1F3F7}|[\u{1F3F8}-\u{1F3FF}]|[\u{1F400}-\u{1F43E}]|\u{1F43F}|\u{1F440}|\u{1F441}|[\u{1F442}-\u{1F4F7}]|\u{1F4F8}|[\u{1F4F9}-\u{1F4FC}]|\u{1F4FD}|\u{1F4FF}|[\u{1F500}-\u{1F53D}]|[\u{1F549}-\u{1F54A}]|[\u{1F54B}-\u{1F54E}]|[\u{1F550}-\u{1F567}]|[\u{1F56F}-\u{1F570}]|[\u{1F573}-\u{1F579}]|\u{1F57A}|\u{1F587}|[\u{1F58A}-\u{1F58D}]|\u{1F590}|[\u{1F595}-\u{1F596}]|\u{1F5A4}|\u{1F5A5}|\u{1F5A8}|[\u{1F5B1}-\u{1F5B2}]|\u{1F5BC}|[\u{1F5C2}-\u{1F5C4}]|[\u{1F5D1}-\u{1F5D3}]|[\u{1F5DC}-\u{1F5DE}]|\u{1F5E1}|\u{1F5E3}|\u{1F5E8}|\u{1F5EF}|\u{1F5F3}|\u{1F5FA}|[\u{1F5FB}-\u{1F5FF}]|\u{1F600}|[\u{1F601}-\u{1F610}]|\u{1F611}|[\u{1F612}-\u{1F614}]|\u{1F615}|\u{1F616}|\u{1F617}|\u{1F618}|\u{1F619}|\u{1F61A}|\u{1F61B}|[\u{1F61C}-\u{1F61E}]|\u{1F61F}|[\u{1F620}-\u{1F625}]|[\u{1F626}-\u{1F627}]|[\u{1F628}-\u{1F62B}]|\u{1F62C}|\u{1F62D}|[\u{1F62E}-\u{1F62F}]|[\u{1F630}-\u{1F633}]|\u{1F634}|[\u{1F635}-\u{1F640}]|[\u{1F641}-\u{1F642}]|[\u{1F643}-\u{1F644}]|[\u{1F645}-\u{1F64F}]|[\u{1F680}-\u{1F6C5}]|[\u{1F6CB}-\u{1F6CF}]|\u{1F6D0}|[\u{1F6D1}-\u{1F6D2}]|[\u{1F6E0}-\u{1F6E5}]|\u{1F6E9}|[\u{1F6EB}-\u{1F6EC}]|\u{1F6F0}|\u{1F6F3}|[\u{1F6F4}-\u{1F6F6}]|[\u{1F6F7}-\u{1F6F8}]|[\u{1F910}-\u{1F918}]|[\u{1F919}-\u{1F91E}]|\u{1F91F}|[\u{1F920}-\u{1F927}]|[\u{1F928}-\u{1F92F}]|\u{1F930}|[\u{1F931}-\u{1F932}]|[\u{1F933}-\u{1F93A}]|[\u{1F93C}-\u{1F93E}]|[\u{1F940}-\u{1F945}]|[\u{1F947}-\u{1F94B}]|\u{1F94C}|[\u{1F950}-\u{1F95E}]|[\u{1F95F}-\u{1F96B}]|[\u{1F980}-\u{1F984}]|[\u{1F985}-\u{1F991}]|[\u{1F992}-\u{1F997}]|\u{1F9C0}|[\u{1F9D0}-\u{1F9E6}]/gu; 59 | 60 | //仿GM_xmlhttpRequest函数v1.3 61 | if (typeof(GM_xmlhttpRequest) == "undefined") { 62 | var GM_xmlhttpRequest = function(GM_param) { 63 | 64 | var xhr = new XMLHttpRequest(); //创建XMLHttpRequest对象 65 | xhr.open(GM_param.method, GM_param.url, true); 66 | if (GM_param.responseType) xhr.responseType = GM_param.responseType; 67 | if (GM_param.overrideMimeType) xhr.overrideMimeType(GM_param.overrideMimeType); 68 | xhr.onreadystatechange = function() //设置回调函数 69 | { 70 | if (xhr.readyState === xhr.DONE) { 71 | if (xhr.status === 200 && GM_param.onload) 72 | GM_param.onload(xhr); 73 | if (xhr.status !== 200 && GM_param.onerror) 74 | GM_param.onerror(xhr); 75 | } 76 | } 77 | 78 | for (var header in GM_param.headers) { 79 | xhr.setRequestHeader(header, GM_param.headers[header]); 80 | } 81 | 82 | xhr.send(GM_param.data ? GM_param.data : null); 83 | } 84 | } 85 | //仿GM_getValue函数v1.0 86 | if(typeof(GM_getValue) == "undefined") 87 | { 88 | var GM_getValue = function(name, type){ 89 | var value = localStorage.getItem(name); 90 | if (value == undefined) return value; 91 | if ((/^(?:true|false)$/i.test(value) && type == undefined) || type == "boolean") 92 | { 93 | if (/^true$/i.test(value)) 94 | return true; 95 | else if (/^false$/i.test(value)) 96 | return false; 97 | else 98 | return Boolean(value); 99 | } 100 | else if((/^\-?[\d\.]+$/i.test(value) && type == undefined) || type == "number") 101 | return Number(value); 102 | else 103 | return value; 104 | } 105 | } 106 | //仿GM_setValue函数v1.0 107 | if(typeof(GM_setValue) == "undefined") 108 | { 109 | var GM_setValue = function(name, value){ 110 | localStorage.setItem(name, value); 111 | } 112 | } 113 | //仿GM_deleteValue函数v1.0 114 | if(typeof(GM_deleteValue) == "undefined") 115 | { 116 | var GM_deleteValue = function(name){ 117 | localStorage.removeItem(name); 118 | } 119 | } 120 | //仿GM_listValues函数v1.0 121 | if(typeof(GM_listValues) == "undefined") 122 | { 123 | var GM_listValues = function(){ 124 | var keys = []; 125 | for (var ki=0, kilen=localStorage.length; ki database_structure_version) 220 | { 221 | alert("Wiki数据库结构已更新,你的 " + scriptName + " 版本可能已经不适用新的数据库,请更新你的脚本。"); 222 | return; 223 | } 224 | } 225 | //处理行的页面 226 | function dealRows(response, dataset) 227 | { 228 | var PageDOM = new DOMParser().parseFromString(response, "text/html"); 229 | 230 | var page_get_w = document.querySelector("#ETB_page-get"); 231 | if (page_get_w) 232 | { 233 | var statetxt = page_get_w.querySelector(".page-get-rows"); 234 | statetxt.classList.add("page-load"); 235 | statetxt.innerHTML = "获取成功"; 236 | } 237 | 238 | var table = PageDOM.querySelector(newRe?"#readme .markdown-body table:nth-of-type(2)":"#wiki-body .markdown-body table").tBodies[0]; 239 | 240 | rowsCount = table.rows.length; 241 | for(var ri=0, rilen=table.rows.length; ri 0) //链接写在title 328 | { 329 | InfoObj.src = node.title; 330 | }else if(node.src.length > 0) //链接写在src 331 | { 332 | InfoObj.src = node.src; 333 | }else 334 | { 335 | console.error("发现未知的其他图片地址格式",node,"来自",infoDom); 336 | } 337 | InfoObj.alt = node.alt; 338 | break; 339 | case "A": 340 | InfoObj.type = 3; 341 | InfoObj.text = node.textContent; 342 | InfoObj.href = node.href; 343 | InfoObj.title = node.title; 344 | break; 345 | default: //未知的其他格式 346 | console.error("发现未知的其他Node格式:" + node.nodeName,node,"来自",infoDom); 347 | InfoObj.type = 0; 348 | InfoObj.text = node.textContent; 349 | continue; 350 | } 351 | arr.push(InfoObj); 352 | } 353 | } 354 | return arr; 355 | } 356 | //介绍信息数组输出到CSS 357 | function InfoArrayToCssString(infoArr, creatImage) 358 | { 359 | if (creatImage == undefined) creatImage = true; 360 | var infoArrTmp = infoArr.concat(); //创建编辑用临时数组 361 | var str = []; //最终输出的内容字符串的部件数组 362 | var lastText = false; //上一条是不是文字,用渝判断下一条是储存到临时数组等候拼接还是将前方的加入最终字符串 363 | var strPart = []; //当前的临时字符串(储存多块相邻文本,用于拼接) 364 | while (infoArrTmp.length>0) 365 | { 366 | var inf = infoArrTmp.shift(); 367 | if (inf.type == 0 || inf.type == 1 || inf.type == 3) //type,0是文字,1是换行,2是图片,3是链接 368 | { //处理文本 369 | if (lastText) //如果上一条不是文本 370 | { //添加一条新的文本,或者换行 371 | strPart.push(inf.text || "\\A"); 372 | }else 373 | { //处理每一张图片 374 | str.push(strPart.map(function(item){return 'url("' + item + '")'}).join("")); //已储存的图片添加到最终字符串 375 | strPart = []; 376 | lastText = true; 377 | strPart.push(inf.text || "\\A"); 378 | } 379 | }else if (creatImage) //如果同意生成图片,才处理图片 380 | { //处理图片 381 | if (lastText) 382 | { //处理每一条文本 383 | var txtTmp = strPart.join(""); 384 | txtTmp = txtTmp.replace(/\"/igm,"\\\""); //将引号改为斜杠引号 385 | if (!creatImage) txtTmp = dealEmoji(txtTmp); //去除Emoji 386 | str.push('"' + txtTmp + '"'); 387 | strPart = []; 388 | lastText = false; 389 | strPart.push(inf.src); 390 | }else 391 | { //添加一张新的图片 392 | strPart.push(inf.src); 393 | } 394 | } 395 | } 396 | //最后没被处理掉的 397 | if (lastText) 398 | { //处理每一条文本 399 | var txtTmp = strPart.join(""); 400 | txtTmp = txtTmp.replace(/\"/igm,"\\\""); //将引号改为斜杠引号 401 | if (!creatImage) txtTmp = dealEmoji(txtTmp); //去除Emoji 402 | str.push('"' + txtTmp + '"'); 403 | strPart = []; 404 | lastText = false; 405 | }else 406 | { //处理每一张图片 407 | str.push(strPart.map(function(item){return 'url("' + item + '")'}).join("")); 408 | strPart = []; 409 | lastText = true; 410 | } 411 | return str.join(""); 412 | } 413 | 414 | //处理Tag页面 415 | function dealTags(response, rowdataset) 416 | { 417 | var rowTags = rowdataset.tags; 418 | var PageDOM = new DOMParser().parseFromString(response, "text/html"); 419 | 420 | var table = PageDOM.querySelector(newRe?"#readme .markdown-body table:nth-of-type(2)":"#wiki-body .markdown-body table"); 421 | if (table == undefined) 422 | { 423 | alert(PageDOM.title + "\n该页面未发现数据表格,可能存在格式错误。") 424 | console.error("未发现表格",PageDOM.title); 425 | } 426 | var tBody = table.tBodies[0]; 427 | 428 | for(var ri=0, rilen=tBody.rows.length; ri 2) 433 | {//没有足够单元格的跳过 434 | tag.name = trow.cells[0].textContent.replace(/(^\s|\s$)/ig,""); //去除首尾空格 435 | tag.cname = InfoToArray(trow.cells[1]); 436 | tag.info = InfoToArray(trow.cells[2]); 437 | tag.links = LinksToArray(trow.cells[3]); 438 | //type=0代表一行翻译,1代表注释 439 | tag.type = tag.name.replace(/\s/ig,"").length < 1 ? 1 : 0; //英文去除所有空格后如果没有文字,则算为注释 440 | if (tag.type != 1 && tag.cname.length < 1) //不是注释,中文名又没有文字 441 | { 442 | //console.error("发现无中文翻译行%d - %s:%s",ri,rowdataset.name,tag.name); 443 | } 444 | if (tag.type != 1 && rowTags.some(function(ttag){return ttag.name == tag.name;})) //从数组中搜索任一符合条件的,返回true 445 | { 446 | console.error("发现重复定义行%d - %s:%s",ri,rowdataset.name,tag.name); 447 | } 448 | rowTags.push(tag); 449 | } 450 | else 451 | { 452 | console.error("发现无3单元格的错误行%d %s",ri,tag.name); 453 | } 454 | } 455 | rowsCurrent++; 456 | } 457 | 458 | //点击开始任务按钮 459 | function startProgram(dataset, mode){ 460 | var downOver = startProgramCheck(dataset, mode); 461 | if (!downOver || downOverCheckHook == undefined) 462 | { 463 | GM_xmlhttpRequest({ 464 | method: "GET", 465 | url: wiki_URL + "/" + wiki_version_filename, 466 | onload: function(response) { 467 | dealVersion(response.responseText); 468 | GM_xmlhttpRequest({ 469 | method: "GET", 470 | url: wiki_URL + "/" + rows_filename, 471 | onload: function(response) { 472 | dealRows(response.responseText,dataset); 473 | } 474 | }); 475 | }, 476 | onerror: function(response) { 477 | dealVersion(""); 478 | GM_xmlhttpRequest({ 479 | method: "GET", 480 | url: wiki_URL + "/" + rows_filename, 481 | onload: function(response) { 482 | dealRows(response.responseText,dataset); 483 | } 484 | }); 485 | }, 486 | }); 487 | downOverCheckHook = setInterval(function () { startProgramCheck(dataset, mode) }, 200); 488 | } 489 | if (!downOver) 490 | { 491 | buildDownloadProgress(); 492 | } 493 | } 494 | 495 | //创建下载进度窗口 496 | function buildDownloadProgress() 497 | { 498 | var page_get_w = document.querySelector("#ETB_page-get"); 499 | if (!page_get_w) 500 | { 501 | windowInserPlace.appendChild(buildMenuModal("window", "ETB_page-get", "数据获取进度", null, [ 502 | buildMenuList([ 503 | buildMenuItem((function() 504 | { 505 | var div = document.createElement("div"); 506 | var span1 = document.createElement("span"); 507 | span1.className = "page-title"; 508 | span1.innerHTML = "Wiki结构版本"; 509 | div.appendChild(span1); 510 | var span2 = document.createElement("span"); 511 | span2.className = "page-get-wiki-version"; 512 | span2.innerHTML = "等待"; 513 | div.appendChild(span2); 514 | return div; 515 | })() 516 | ), 517 | buildMenuItem((function() 518 | { 519 | var div = document.createElement("div"); 520 | var span1 = document.createElement("span"); 521 | span1.className = "page-title"; 522 | span1.innerHTML = "列表页面"; 523 | div.appendChild(span1); 524 | var span2 = document.createElement("span"); 525 | span2.className = "page-get-rows"; 526 | span2.innerHTML = "等待"; 527 | div.appendChild(span2); 528 | return div; 529 | })() 530 | ), 531 | ]) 532 | ], 533 | [ 534 | ".ETB_page-get .page-title" + "{\r\n" + [ 535 | 'font-weight: bold', 536 | 'margin-right: 15px', 537 | ].join(';\r\n') + "\r\n}", 538 | ".ETB_page-get .page-load" + "{\r\n" + [ 539 | 'color: #0A0', 540 | ].join(';\r\n') + "\r\n}", 541 | ].join('\r\n') 542 | )); 543 | } 544 | else 545 | { 546 | page_get_w.style.display = "block"; 547 | } 548 | } 549 | 550 | //检测下载完成情况 551 | function startProgramCheck(dataset, mode) 552 | { 553 | if (rowsCount > 0 && rowsCurrent >= rowsCount) 554 | { 555 | console.debug("获取完成"); 556 | clearInterval(downOverCheckHook); 557 | switch (mode) { 558 | case 1: 559 | buildJSOutput(dataset); 560 | break; 561 | case 0: 562 | default: 563 | buildCSSOutput(dataset); 564 | break; 565 | } 566 | var page_get_w = document.querySelector("#ETB_page-get"); 567 | if (page_get_w) 568 | { 569 | page_get_w.parentNode.removeChild(page_get_w); 570 | } 571 | return true; 572 | } 573 | else 574 | { 575 | console.debug("获取%d/%d",rowsCurrent, rowsCount); 576 | return false; 577 | } 578 | } 579 | 580 | //获取完成后创建CSS输出窗口 581 | function buildCSSOutput(dataset) 582 | { 583 | var css = createOutputCSS(dataset 584 | ,GM_getValue("ETB_create-info","boolean") 585 | ,GM_getValue("ETB_create-info-image","boolean") 586 | ,GM_getValue("ETB_create-cname-image","boolean") 587 | ); 588 | var downBlob = new Blob([css], {'type': 'text\/css'}); 589 | var downurl = window.URL.createObjectURL(downBlob); 590 | 591 | var css_output_w = document.querySelector("#ETB_css-output"); 592 | if (!css_output_w) 593 | { 594 | windowInserPlace.appendChild(buildMenuModal("window", "ETB_css-output", "用户样式版EhTagTranslator", null, 595 | [ 596 | buildMenuList([ 597 | buildMenuItem("CSS文本", 598 | (function() 599 | { 600 | var textarea = document.createElement("textarea"); 601 | textarea.id = "ETB_css-textarea"; 602 | textarea.name = textarea.id; 603 | textarea.className = "txta " + textarea.id; 604 | textarea.value = css; 605 | textarea.wrap = "off"; 606 | textarea.setAttribute("readonly",true); 607 | return textarea; 608 | })() 609 | ,buildSVG("css")), 610 | buildMenuItem("直接下载CSS文件",null,buildSVG("download"),downurl,1), 611 | ]) 612 | ], 613 | [ 614 | ".ETB_css-output .txta" + "{\r\n" + [ 615 | 'resize: vertical', 616 | 'width:100%', 617 | 'height:300px', 618 | ].join(';\r\n') + "\r\n}", 619 | ].join('\r\n') 620 | )); 621 | } 622 | else 623 | { 624 | css_output_w.style.display = "block"; 625 | css_output_w.querySelector(".ETB_css-textarea").value = css; 626 | css_output_w.querySelector("a").href = downurl; 627 | } 628 | } 629 | 630 | //开始构建CSS 631 | function createOutputCSS(dataset, createInfo, createInfoImage, createCnameImage) 632 | { 633 | if (createInfo == undefined) createInfo = true; 634 | if (createInfoImage == undefined) createInfoImage = true; 635 | if (createCnameImage == undefined) createCnameImage = true; 636 | var date = new Date(); 637 | 638 | var cssAry = []; 639 | //样式信息说明 640 | cssAry.push( 641 | "/* EhTagTranslator 用户样式版,由 " + scriptName + " v" + scriptVersion + " 构建" 642 | ," * 数据来源于" + wiki_URL 643 | ," * 构建时间为" 644 | ," * " + date.toString() 645 | ," */" 646 | ) 647 | //样式命名区间 648 | cssAry.push( 649 | //▼CSS内容部分 650 | "@namespace url(http://www.w3.org/1999/xhtml);" 651 | //▲CSS内容部分 652 | ); 653 | 654 | //表里通用样式 655 | cssAry.push("" 656 | //▼CSS内容部分 657 | ,"/* 表里通用样式 */" 658 | ,"@-moz-document" 659 | ," domain('exhentai.org')," 660 | ," domain('e-hentai.org')" 661 | ,"{" 662 | ,GM_getValue("ETB_global-style") 663 | ,"}" 664 | //▲CSS内容部分 665 | ); 666 | 667 | //表站样式 668 | cssAry.push("" 669 | //▼CSS内容部分 670 | ,"/* 表站样式 */" 671 | ,"@-moz-document" 672 | ," domain('e-hentai.org')" 673 | ,"{" 674 | ,GM_getValue("ETB_global-style-eh") 675 | ,"}" 676 | //▲CSS内容部分 677 | ); 678 | 679 | //里站样式 680 | cssAry.push("" 681 | //▼CSS内容部分 682 | ,"/* 里站样式 */" 683 | ,"@-moz-document" 684 | ," domain('exhentai.org')" 685 | ,"{" 686 | ,GM_getValue("ETB_global-style-ex") 687 | ,"}" 688 | //▲CSS内容部分 689 | ); 690 | 691 | //翻译内容 692 | cssAry.push("" 693 | //▼CSS内容部分 694 | ,"/* 翻译内容 */" 695 | ,"@-moz-document" 696 | ," domain('exhentai.org')," 697 | ," domain('e-hentai.org')" 698 | ,"{" 699 | //▲CSS内容部分 700 | ); 701 | 702 | dataset.forEach(function(row){ 703 | 704 | //添加行名的注释 705 | cssAry.push("" 706 | ,"/* " + row.name 707 | ," * " + row.cname 708 | .filter(function(item){return item.type==0;}) 709 | .map(function(item){return item.text;}) 710 | .join("") 711 | ," */" 712 | ); 713 | 714 | row.tags.forEach(function(tag){ 715 | 716 | if (tag.type == 0) 717 | { 718 | var tagid = (row.name=="misc"?"":row.name + ":") + tag.name.replace(/\s/ig,"_"); 719 | cssAry.push("" 720 | //▼CSS内容部分 721 | ," a[id=\"ta_" + tagid + "\"]{" 722 | ," font-size:0;" 723 | ," }" 724 | ," a[id=\"ta_" + tagid + "\"]::before{" 725 | ," content:" + InfoArrayToCssString(tag.cname, createCnameImage) + ";" 726 | ," }" 727 | //▲CSS内容部分 728 | ); 729 | if (createInfo) 730 | { 731 | var sinfo = InfoArrayToCssString(tag.info, createInfoImage); 732 | if (sinfo.replace(/\s/ig,"").length > 0) 733 | { 734 | cssAry.push("" 735 | //▼CSS内容部分 736 | ," a[id=\"ta_" + tagid + "\"]::after{" 737 | ," content:" + sinfo + ";" 738 | ," }" 739 | //▲CSS内容部分 740 | ); 741 | } 742 | } 743 | } 744 | else 745 | { //将注释写成CSS注释 746 | cssAry.push( 747 | "/* " + InfoArrayToCssString(tag.cname, false) 748 | ," * " + InfoArrayToCssString(tag.info, false) 749 | ," */" 750 | ); 751 | } 752 | 753 | })//row.tags.forEach 754 | });//dataset.forEach 755 | 756 | cssAry.push( 757 | //▼CSS内容部分 758 | "}" 759 | //▲CSS内容部分 760 | ); 761 | 762 | var css = cssAry.join("\r\n"); 763 | return css; 764 | } 765 | 766 | //获取完成后创建JS输出窗口 767 | function buildJSOutput(dataset) 768 | { 769 | var json = createOutputJSON(dataset 770 | ,GM_getValue("ETB_create-info","boolean") 771 | ,GM_getValue("ETB_create-info-image","boolean") 772 | ,GM_getValue("ETB_create-cname-image","boolean") 773 | ); 774 | var jsonStr = JSON.stringify(json); 775 | var downBlob = new Blob([jsonStr], {'type': 'text\/json'}); 776 | var downurl = window.URL.createObjectURL(downBlob); 777 | 778 | var js_output_w = document.querySelector("#ETB_js-output"); 779 | if (!js_output_w) 780 | { 781 | windowInserPlace.appendChild(buildMenuModal("window", "ETB_js-output", "用户脚本版EhTagTranslator数据库", null, 782 | [ 783 | buildMenuList([ 784 | buildMenuItem("JSON文本", 785 | (function() 786 | { 787 | var textarea = document.createElement("textarea"); 788 | textarea.id = "ETB_js-textarea"; 789 | textarea.name = textarea.id; 790 | textarea.className = "txta " + textarea.id; 791 | textarea.value = jsonStr; 792 | textarea.setAttribute("readonly",true); 793 | return textarea; 794 | })() 795 | ,buildSVG("json")), 796 | buildMenuItem("数据库数量", 797 | (function() 798 | { 799 | var tb = document.createElement("table"); 800 | tb.id = "ETB_database-count"; 801 | tb.name = tb.id; 802 | tb.className = tb.id; 803 | //正式开始构建内容 804 | //tHead 805 | tb.createTHead(); 806 | var th = tb.tHead.insertRow(); 807 | th.insertCell().appendChild(document.createTextNode("行名")); 808 | th.insertCell().appendChild(document.createTextNode("数据行数")); 809 | th.insertCell().appendChild(document.createTextNode("注释行数")); 810 | //tBody 811 | json.dataset.forEach(function(item){ 812 | var tr = tb.insertRow(); 813 | tr.insertCell().appendChild(document.createTextNode(item.cname 814 | .filter(function(item){return item.type==0;}) 815 | .map(function(item){return item.text;}) 816 | .join(""))); 817 | tr.insertCell().appendChild(document.createTextNode(item.tags.filter(function(item){return item.type==0}).length)); 818 | tr.insertCell().appendChild(document.createTextNode(item.tags.filter(function(item){return item.type==1}).length)); 819 | }) 820 | return tb; 821 | })() 822 | ,buildSVG("book")), 823 | buildMenuItem("直接下载JSON文件",null,buildSVG("download"),downurl,1) 824 | ]) 825 | ], 826 | [ 827 | ".ETB_js-output .txta" + "{\r\n" + [ 828 | 'resize: vertical', 829 | 'width:100%', 830 | 'height:200px', 831 | ].join(';\r\n') + "\r\n}", 832 | "#ETB_js-output .select-menu-list" + "{\r\n" + [ 833 | 'max-height: 700px', 834 | ].join(';\r\n') + "\r\n}", 835 | "#ETB_database-count,#ETB_database-count td" + "{\r\n" + [ 836 | 'border: solid 1px lightgrey;', 837 | ].join(';\r\n') + "\r\n}", 838 | ].join('\r\n') 839 | )); 840 | } 841 | else 842 | { 843 | js_output_w.style.display = "block"; 844 | js_output_w.querySelector(".ETB_js-textarea").value = jsonStr; 845 | js_output_w.querySelector("a").href = downurl; 846 | } 847 | } 848 | 849 | //开始构建JSON 850 | function createOutputJSON(dataset, createInfo, createInfoImage, createCnameImage) 851 | { 852 | if (createInfo == undefined) createInfo = true; 853 | if (createInfoImage == undefined) createInfoImage = true; 854 | if (createCnameImage == undefined) createCnameImage = true; 855 | 856 | var outArray = 857 | /* 858 | * 生成一个不会干涉到原对象的Row对象 859 | */ 860 | dataset.map(function(row_orignal){ 861 | var row = Object.assign(new rowObj(), row_orignal); 862 | row.cname=row_orignal.cname 863 | .filter(function(item){return createCnameImage || item.type != 2;}) 864 | .map(function(item){ 865 | var newItem = Object.assign({}, item); 866 | if(!createCnameImage && item.text) { 867 | newItem.text = dealEmoji(item.text); 868 | } 869 | return newItem; 870 | }); 871 | if (createInfo) 872 | { 873 | row.info=row_orignal.info 874 | .filter(function(item){return createInfoImage || item.type != 2;}) 875 | .map(function(item){ 876 | var newItem = Object.assign({}, item); 877 | if(!createInfoImage && item.text) { 878 | newItem.text = dealEmoji(item.text); 879 | } 880 | return newItem; 881 | }); 882 | } 883 | else 884 | { 885 | row.info = null; 886 | } 887 | row.links=row_orignal.links 888 | .map(function(item){ 889 | var newItem = Object.assign(new linkObj(), item); 890 | return newItem; 891 | }); 892 | 893 | row.tags = 894 | /* 895 | * 生成一个不会干涉到原对象的Tag对象 896 | */ 897 | row_orignal.tags.map(function(tag_orignal){ 898 | var tag = Object.assign(new tagObj(), tag_orignal); 899 | tag.cname=tag_orignal.cname 900 | .filter(function(item){return createCnameImage || item.type != 2;}) 901 | .map(function(item){ 902 | var newItem = Object.assign({}, item); 903 | if(!createCnameImage && item.text) { 904 | newItem.text = dealEmoji(item.text); 905 | } 906 | return newItem; 907 | }); 908 | tag.links=tag_orignal.links 909 | .map(function(item){ 910 | var newItem = Object.assign(new linkObj(), item); 911 | return newItem; 912 | }); 913 | 914 | if (createInfo || tag.type==1) 915 | { 916 | tag.info=tag_orignal.info 917 | .filter(function(item){return createInfoImage || item.type != 2;}) 918 | .map(function(item){ 919 | var newItem = Object.assign({}, item); 920 | if(!createInfoImage && item.text) { 921 | newItem.text = dealEmoji(item.text); 922 | } 923 | return newItem; 924 | }); 925 | } 926 | else 927 | { 928 | tag.info = null; 929 | } 930 | return tag; 931 | })//row.tags.forEach 932 | 933 | return row; 934 | });//dataset.forEach 935 | 936 | var date = new Date(); 937 | var outJson = 938 | { 939 | "scriptName":scriptName, 940 | "scriptVersion":scriptVersion, 941 | "database-structure-version":database_structure_version, 942 | "date":date.getTime(), 943 | "dataset":outArray 944 | } 945 | return outJson; 946 | } 947 | 948 | //去除文本中的Emoji字符 949 | function dealEmoji(str) 950 | { 951 | return str.replace(emojireg,""); 952 | } 953 | 954 | //生成按钮 955 | function buildButton(title, icon, modal) 956 | { 957 | var li = document.createElement("li"); 958 | var select_menu = document.createElement("div"); 959 | select_menu.className = "select-menu js-menu-container js-select-menu"; 960 | li.appendChild(select_menu); 961 | var button = document.createElement("button"); 962 | button.className = "btn btn-sm select-menu-button js-menu-target css-truncate"; 963 | button.onclick = function(){ 964 | modal.style.display = "block"; 965 | } 966 | select_menu.appendChild(button); 967 | var span = document.createElement("span"); 968 | span.className = "js-select-button"; 969 | if (icon != undefined) 970 | span.appendChild(icon); 971 | span.innerHTML += title; 972 | button.appendChild(span); 973 | select_menu.appendChild(modal); 974 | 975 | button.onclick = function(){ 976 | modal.style.display = "block"; 977 | } 978 | return li; 979 | } 980 | 981 | //生成菜单窗口 982 | function buildMenuModal(mode, id, stitle, filters, lists, sstyle) 983 | { 984 | 985 | var modal_holder = document.createElement("div"); 986 | modal_holder.className = "select-menu-modal-holder js-menu-content js-navigation-container js-active-navigation-container"; 987 | if (id != undefined) 988 | { 989 | modal_holder.id = id; 990 | modal_holder.classList.add(id); 991 | } 992 | if (sstyle != undefined) 993 | { 994 | var style = document.createElement("style"); 995 | style.innerHTML = sstyle; 996 | modal_holder.appendChild(style); 997 | } 998 | 999 | var modal = document.createElement("div"); 1000 | modal.className = "select-menu-modal subscription-menu-modal js-menu-content"; 1001 | modal_holder.appendChild(modal); 1002 | 1003 | var header = document.createElement("div"); 1004 | header.className = "select-menu-header js-navigation-enable"; 1005 | modal.appendChild(header); 1006 | 1007 | var CloseSvg = buildSVG("Close"); 1008 | header.appendChild(CloseSvg); 1009 | CloseSvg.onclick = function(){ 1010 | modal_holder.style.display = "none"; 1011 | } 1012 | 1013 | switch (mode) { 1014 | case "window": 1015 | modal_holder.style.display = "block"; 1016 | } 1017 | 1018 | var title = document.createElement("span"); 1019 | title.className = "select-menu-title"; 1020 | title.innerHTML = stitle; 1021 | header.appendChild(title); 1022 | 1023 | if (lists != undefined) 1024 | { 1025 | for(var li = 0, lilen=lists.length; li 40 | // @copyright 2017+, Mapaler , xioxin 41 | // ==/UserScript== 42 | 43 | // language=CSS 44 | const uiTranslateStyle = ` 45 | /** uiTranslateStyle **/ 46 | .cs, .cn { 47 | font-size: 0 !important; 48 | text-align: center; 49 | line-height: 0 !important; 50 | } 51 | .cs:after, .cn:after { 52 | font-size: 9pt; 53 | display: block; 54 | text-align: center; 55 | line-height: 20px; 56 | } 57 | .cn:after { 58 | line-height: 35px; 59 | } 60 | 61 | .ct1:after{ 62 | content: "其他"; 63 | } 64 | .ct8:after{ 65 | content: "亚洲"; 66 | } 67 | .ct7:after{ 68 | content: "Cosplay"; 69 | } 70 | .ct6:after{ 71 | content: "图集"; 72 | } 73 | .ct9:after{ 74 | content: "非H"; 75 | } 76 | .ct2:after{ 77 | content: "同人"; 78 | } 79 | .ct3:after{ 80 | content: "漫画"; 81 | } 82 | .ct4:after{ 83 | content: "画师集"; 84 | } 85 | .ct5:after{ 86 | content: "游戏CG"; 87 | } 88 | .cta:after{ 89 | content: "西方"; 90 | } 91 | `; 92 | 93 | 94 | const baseStyle = { 95 | // language=CSS 96 | 'public':` 97 | div.gt:before,div.gtl:before { 98 | font-size: 9pt; 99 | } 100 | #nb { 101 | overflow: visible; 102 | } 103 | div#taglist { 104 | overflow: visible; 105 | min-height: 295px; 106 | height: auto !important; 107 | position: static; 108 | z-index: 10; 109 | } 110 | div#gmid { 111 | min-height: 330px; 112 | height:auto; 113 | } 114 | #taglist a{ 115 | background:inherit; 116 | position: relative; 117 | } 118 | #taglist a::before{ 119 | font-size:12px; 120 | overflow: hidden; 121 | height: 20px; 122 | line-height: 20px; 123 | } 124 | #taglist a::after{ 125 | display: block; 126 | color:#FF8E8E; 127 | font-size:14px; 128 | background: inherit; 129 | border: 1px solid #000; 130 | border-radius:5px; 131 | position:absolute; 132 | float: left; 133 | z-index:999; 134 | padding:8px; 135 | box-shadow: 3px 3px 10px #000; 136 | min-width:150px; 137 | max-width:500px; 138 | white-space:pre-wrap; 139 | opacity: 0; 140 | transition: opacity 0.2s; 141 | transform: translate(-50%,20px); 142 | top:-14px; 143 | left: 50%; 144 | pointer-events:none; 145 | font-weight: 400; 146 | line-height: 20px; 147 | } 148 | #taglist a:hover::after, 149 | #taglist a:focus::after{ 150 | opacity: 1; 151 | pointer-events:auto; 152 | } 153 | #taglist a:focus::before, 154 | #taglist a:hover::before { 155 | font-size: 12px; 156 | position: relative; 157 | background-color: inherit; 158 | border: 1px solid #000; 159 | border-bottom-width: 0; 160 | margin: -4px -5px -4px -5px; 161 | padding: 4px 4px 4px 4px; 162 | color:inherit; 163 | border-radius: 5px 5px 0 0; 164 | } 165 | .doubleLang #taglist a{font-size:12px !important;} 166 | .doubleLang #taglist a::before{ 167 | margin-right: 8px; 168 | } 169 | .doubleLang #taglist a::after{top:1px;} 170 | .doubleLang #taglist a:focus, 171 | .doubleLang #taglist a:hover { 172 | background-color: inherit; 173 | border: 1px solid #000; 174 | border-width: 1px 1px 0 1px; 175 | margin: -4px -5px; 176 | padding: 4px 4px; 177 | color:inherit; 178 | border-radius: 5px 5px 0 0; 179 | } 180 | .doubleLang #taglist a:focus::before, 181 | .doubleLang #taglist a:hover::before { 182 | border: none; 183 | border-image-source: url(/img/mr.gif); 184 | border-image-slice: 0 5 0 0; 185 | border-image-width: 7px 5px 8px 0; 186 | border-image-outset: 0 1px 0 0; 187 | border-image-repeat: round; 188 | color:inherit; 189 | font-size: inherit; 190 | margin: -4px 3px -4px -4px; 191 | padding: 4px 5px 4px 4px; 192 | } 193 | div.gt, 194 | div.gtw, 195 | div.gtl{ 196 | line-height: 20px; 197 | height: 20px; 198 | } 199 | .gl3c div.gt { 200 | line-height: unset; 201 | height: unset; 202 | } 203 | #taglist a:hover { z-index: 60; } 204 | #taglist a:focus { z-index: 50; } 205 | #taglist a::after{ z-index: -1; } 206 | #taglist a::before { 207 | z-index: 1; 208 | white-space:nowrap; 209 | }`, 210 | 'ex':`#taglist a::after{ color:#fff; }`, 211 | 'eh':`#taglist a::after{ color:#000; }`, 212 | } 213 | 214 | 215 | var Aria2 = (function (_isGM, _arrFn, _merge, _format, _isFunction) { 216 | var jsonrpc_ver = '2.0'; 217 | 218 | if (_isGM) { 219 | var doRequest = function ( opts ) { 220 | console.warn ([ 221 | 'Warning: You are now using an simple implementation of GM_xmlhttpRequest', 222 | 'Cross-domain request are not avilible unless configured correctly @ target server.', 223 | '', 224 | 'Some of its features are not avilible, such as `username` and `password` field.' 225 | ].join('\n')); 226 | 227 | var oReq = new XMLHttpRequest (); 228 | var cbCommon = function (cb) { 229 | return (function () { 230 | cb ({ 231 | readyState: oReq.readyState, 232 | responseHeaders: opts.getHeader ? oReq.getAllResponseHeaders() : null, 233 | getHeader: oReq.getResponseHeader.bind (oReq), 234 | responseText: oReq.responseText, 235 | status: oReq.status, 236 | statusText: oReq.statusText 237 | }); 238 | }).bind (opts); 239 | }; 240 | 241 | if (opts.onload) oReq.onload = cbCommon (opts.onload); 242 | if (opts.onerror) oReq.onerror = cbCommon (opts.onerror); 243 | 244 | oReq.open(opts.method || 'GET', opts.url, !opts.synchronous); 245 | 246 | if (opts.headers) { 247 | Object.keys(opts.headers).forEach (function (key) { 248 | oReq.setRequestHeader (key, opts.headers[key]); 249 | }); 250 | } 251 | return oReq.send(opts.data || null); 252 | }; 253 | } else { 254 | var doRequest = GM_xmlhttpRequest; 255 | } 256 | 257 | var AriaBase = function ( options ) { 258 | this.options = _merge ({ 259 | auth: { 260 | type: AriaBase.AUTH.noAuth, 261 | user: '', 262 | pass: '' 263 | }, 264 | host: '127.0.0.1', 265 | port: 6800 266 | }, options || {}); 267 | 268 | this.id = parseInt (options, 10) || (+ new Date()); 269 | }; 270 | 271 | // 静态常量 272 | AriaBase.AUTH = { 273 | noAuth: 0, 274 | basic: 1, 275 | secret: 2 276 | }; 277 | 278 | // public 函数 279 | AriaBase.prototype = { 280 | getBasicAuth: function () { 281 | return btoa (_format('%s:%s', this.options.auth.user, this.options.auth.pass)); 282 | }, 283 | 284 | send: function ( bIsDataBatch, data, cbSuccess, cbError ) { 285 | var srcTaskObj = { jsonrpc: jsonrpc_ver, id: this.id }; 286 | 287 | var payload = { 288 | 289 | method: 'POST', 290 | url: _format('http://%s:%s/jsonrpc', this.options.host, this.options.port), 291 | headers: { 292 | 'Content-Type': 'application/json; charset=UTF-8' 293 | }, 294 | data: bIsDataBatch 295 | ? data.map (function (e) { return _merge ({}, srcTaskObj, e); }) 296 | : _merge ({}, srcTaskObj, data), 297 | onload: function (r) { 298 | var repData = JSON.parse (r.responseText); 299 | if (repData.error) { 300 | cbError && cbError (false, repData); 301 | } else { 302 | cbSuccess && cbSuccess (repData); 303 | } 304 | }, 305 | onerror: cbError ? cbError.bind(null, false) : null 306 | }; 307 | 308 | switch ( parseInt (this.options.auth.type, 10) ) { 309 | case AriaBase.AUTH.noAuth: 310 | // DO NOTHING 311 | break; 312 | 313 | case AriaBase.AUTH.basic: 314 | payload.headers.Authorization = 'Basic ' + this.getBasicAuth(); 315 | break; 316 | 317 | case AriaBase.AUTH.secret: 318 | (function (sToken) { 319 | if (bIsDataBatch) { 320 | for (var i = 0; i < payload.data.length; i++) { 321 | payload.data[i].params.splice(0, 0, sToken); 322 | } 323 | } else { 324 | if (!payload.data.params) 325 | payload.data.params = []; 326 | payload.data.params.splice(0, 0, sToken); 327 | } 328 | })(_format('token:%s', this.options.auth.pass)); 329 | break; 330 | 331 | default: 332 | throw new Error('Undefined auth type: ' + this.options.auth.type); 333 | } 334 | 335 | payload.data = JSON.stringify ( payload.data ); 336 | 337 | return doRequest (payload); 338 | }, 339 | 340 | // batchAddUri ( foo, { uri: 'http://example.com/xxx', options: { ... } } ) 341 | batchAddUri: function (fCallback) { 342 | console.warn ( 343 | 'This function [%s] has deprecated! Consider use %s instead.', 344 | 'batchAddUri', 'AriaBase.BATCH' 345 | ); 346 | 347 | // { url, name } 348 | var payload = [].slice.call (arguments, 1).map (function (arg) { 349 | return { 350 | method: 'aria2.addUri', 351 | params: [ arg.uri.map ? arg.uri : [ arg.uri ] ].concat (arg.options || []) 352 | }; 353 | }); 354 | 355 | return this.send (true, payload, fCallback, fCallback); 356 | } 357 | }; 358 | 359 | 360 | // 添加各类函数 361 | AriaBase.fn = {}; 362 | _arrFn.forEach (function (sMethod) { 363 | // 函数链表 364 | AriaBase.fn[sMethod] = sMethod; 365 | 366 | // arg1, arg2, ... , [cbSuccess, [cbError]] 367 | AriaBase.prototype[sMethod] = function ( ) { 368 | var args = [].slice.call (arguments); 369 | 370 | var cbSuccess, cbError; 371 | if (args.length && _isFunction(args[args.length - 1])) { 372 | cbSuccess = args[args.length - 1]; 373 | args.splice (-1, 1); 374 | 375 | if (args.length && _isFunction(args[args.length - 1])) { 376 | cbError = cbSuccess; 377 | cbSuccess = args[args.length - 1]; 378 | args.splice (-1, 1); 379 | } 380 | } 381 | 382 | return this.send (false, { 383 | method: 'aria2.' + sMethod, 384 | params: args 385 | }, cbSuccess, cbError); 386 | }; 387 | }); 388 | 389 | AriaBase.BATCH = function ( parent, cbSuccess, cbFail ) { 390 | if (!(parent instanceof AriaBase)) 391 | throw new Error ('Parent is not AriaBase!'); 392 | 393 | this.parent = parent; 394 | this.data = []; 395 | 396 | this.onSuccess = cbSuccess; 397 | this.onFail = cbFail; 398 | }; 399 | 400 | AriaBase.BATCH.prototype = { 401 | addRaw: function (fn, args) { 402 | this.data.push ({ 403 | method: 'aria2.' + fn, 404 | params: args 405 | }); 406 | return this; 407 | }, 408 | 409 | add: function (fn) { 410 | // People can add more without edit source. 411 | if (!AriaBase.fn[fn]) 412 | throw new Error ('Unknown function: ' + fn + ', please check if you had a typo.'); 413 | 414 | return this.addRaw (fn, [].slice.call(arguments, 1)); 415 | }, 416 | 417 | send: function () { 418 | // bIsDataBatch, data, cbSuccess, cbError 419 | var ret = this.parent.send ( true, this.data, this.onSuccess, this.onFail ); 420 | this.reset (); 421 | return ret; 422 | }, 423 | 424 | getActions: function () { 425 | return this.data.slice(); 426 | }, 427 | 428 | setActions: function (actions) { 429 | if (!actions || !actions.map) return ; 430 | 431 | this.data = actions; 432 | }, 433 | 434 | reset: function () { 435 | this.onSuccess = this.onFail = null; 436 | this.setActions ( [] ); 437 | } 438 | }; 439 | 440 | return AriaBase; 441 | }) 442 | // const 变量 443 | ('undefined' == typeof GM_xmlhttpRequest, [ 444 | "addUri", "addTorrent", "addMetalink", "remove", "forceRemove", 445 | "pause", "pauseAll", "forcePause", "forcePauseAll", "unpause", 446 | "unpauseAll", "tellStatus", "getUris", "getFiles", "getPeers", 447 | "getServers", "tellActive", "tellWaiting", "tellStopped", 448 | "changePosition", "changeUri", "getOption", "changeOption", 449 | "getGlobalOption", "changeGlobalOption", "getGlobalStat", 450 | "purgeDownloadResult", "removeDownloadResult", "getVersion", 451 | "getSessionInfo", "shutdown", "forceShutdown", "saveSession" 452 | ], 453 | // private 函数 454 | (function (base) { 455 | var _isObject = function (obj) { 456 | return obj instanceof Object; 457 | }; 458 | var _merge = function (base) { 459 | var args = arguments, 460 | argL = args.length; 461 | for ( var i = 1; i < argL; i++ ) { 462 | Object.keys (args[i]).forEach (function (key) { 463 | if (_isObject(args[i][key]) && _isObject(base[key])) { 464 | base[key] = _merge (base[key], args[i][key]); 465 | } else { 466 | base[key] = args[i][key]; 467 | } 468 | }); 469 | } 470 | return base; 471 | }; 472 | return _merge; 473 | })(), function (src) { 474 | var args = arguments, 475 | argL = args.length; 476 | 477 | var ret = src.slice (); 478 | for ( var i = 1; i < argL; i++ ) 479 | ret = ret.replace ('%s', args[i]); 480 | return ret; 481 | }, function (foo) { 482 | return typeof foo === 'function' 483 | }); 484 | 485 | 486 | (function() { 487 | 'use strict'; 488 | 489 | window.requestAnimationFrame = unsafeWindow.requestAnimationFrame; 490 | unsafeWindow.wikiUpdate = autoUpdate; 491 | MutationObserver = window.MutationObserver; 492 | 493 | const version_URL="https://github.com/EhTagTranslation/Database/commits"; //GitHub wiki 的地址 494 | const wiki_raw_URL="https://raw.githubusercontent.com/EhTagTranslation/Database/master/database"; //GitHub wiki 的原始文件地址 495 | const rows_filename="rows"; //行名的地址 496 | var pluginVersion = "未获取到版本"; //本程序的默认版本 497 | var pluginName = "EhTagSyringe"; //本程序的默认名称 498 | if (typeof(GM_info)!="undefined") 499 | { 500 | pluginVersion = GM_info.script.version.replace(/(^\s*)|(\s*$)/g, ""); 501 | if (GM_info.script.name_i18n) 502 | { 503 | var i18n = (navigator.language||navigator.userLanguage).replace("-","_"); //获取浏览器语言 504 | pluginName = GM_info.script.name_i18n[i18n]; //支持Tampermonkey 505 | } 506 | else 507 | { 508 | pluginName = GM_info.script.localizedName || //支持Greasemonkey 油猴子 3.x 509 | GM_info.script.name; //支持Violentmonkey(暴力猴),和其他 510 | } 511 | } 512 | var rootScope = null; 513 | 514 | const headLoaded = new Promise(function (resolve, reject) { 515 | if(unsafeWindow.document.head && unsafeWindow.document.head.nodeName == "HEAD"){ 516 | resolve(unsafeWindow.document.head); 517 | }else{ 518 | //监听DOM变化 519 | MutationObserver = window.MutationObserver; 520 | var observer = new MutationObserver(function(mutations) { 521 | for(let i in mutations){ 522 | let mutation = mutations[i]; 523 | //监听到HEAD 结束 524 | if(mutation.target.nodeName == "HEAD"){ 525 | observer.disconnect(); 526 | resolve(mutation.target); 527 | break; 528 | } 529 | } 530 | }); 531 | observer.observe(document, {childList: true, subtree: true, attributes: true}); 532 | } 533 | }); 534 | 535 | function AddGlobalStyle(css) { 536 | //等待head加载完毕 537 | headLoaded.then(function (head) { 538 | GM_addStyle(css); 539 | }) 540 | } 541 | 542 | AddGlobalStyle(`@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}`); 543 | 544 | var defaultConfig = { 545 | 'showDescription':true, 546 | 'imageLimit':3, 547 | 'showIcon':true, 548 | 'syringe':true, 549 | 'searchHelper':true, 550 | 'magnetHelper':true, 551 | 'UITranslate':true, 552 | 'download2miwifi':false, 553 | 'ariaHelper':false, 554 | 'doubleLang': false, 555 | 'ariaOptions':{ 556 | auth:{ 557 | type: '0', 558 | user: '', 559 | pass: '' 560 | }, 561 | host: 'localhost', 562 | port: 6800 563 | }, 564 | 'style':{ 565 | 'public':``, 566 | 'ex':``, 567 | 'eh':``, 568 | } 569 | }; 570 | 571 | var etbConfig = GM_getValue('config'); 572 | 573 | if(!etbConfig){ 574 | /*默认配置 json转换是用来深拷贝 切断关联 */ 575 | etbConfig = JSON.parse(JSON.stringify(defaultConfig)); 576 | // 不用存储 反正是默认的 577 | // GM_setValue('config',etbConfig); 578 | } 579 | var tagsData = []; 580 | if ((/(exhentai\.org|e-hentai\.org)/).test(unsafeWindow.location.href)) { 581 | tagsData = GM_getValue('tags'); 582 | } 583 | 584 | 585 | // 配置自动升级 586 | for(var i in defaultConfig){ 587 | if(typeof etbConfig[i] === "undefined"){ 588 | etbConfig[i] = JSON.parse(JSON.stringify(defaultConfig[i])); 589 | } 590 | } 591 | 592 | 593 | 594 | console.log('ets config:',etbConfig); 595 | 596 | 597 | function EhTagUITranslator(){ 598 | 599 | //完整匹配才替换 600 | function routineReplace(query,dictionaries) { 601 | let elements = document.querySelectorAll(query); 602 | if(elements && elements.length){ 603 | elements.forEach(function (element) { 604 | if(element){ 605 | for(var i in element.childNodes){ 606 | let node = element.childNodes[i]; 607 | if(node.nodeName == '#text'){ 608 | let key = trim(node.textContent); 609 | if(dictionaries[key]){ 610 | node.textContent = node.textContent.replace(key,dictionaries[key]); 611 | } 612 | } 613 | } 614 | } 615 | }) 616 | } 617 | } 618 | 619 | function routineTextReplace(query,dictionaries) { 620 | let elements = document.querySelectorAll(query); 621 | if(elements && elements.length){ 622 | elements.forEach(function (element) { 623 | let key = trim(element.innerText); 624 | if(dictionaries[key]){ 625 | element.innerText = dictionaries[key]; 626 | } 627 | }) 628 | } 629 | } 630 | 631 | 632 | //不需要完整匹配直接替换 633 | function localRoutineReplace(query,dictionaries) { 634 | let elements = document.querySelectorAll(query); 635 | if(elements && elements.length){ 636 | elements.forEach(function (element) { 637 | if(element){ 638 | for(var key in dictionaries){ 639 | element.innerHTML = element.innerHTML.replace(key,dictionaries[key]) 640 | } 641 | } 642 | }) 643 | } 644 | } 645 | 646 | function inputReplace(query,text) { 647 | let input = document.querySelector(query); 648 | if(input)input.value = text; 649 | } 650 | function inputPlaceholder(query,text) { 651 | let input = document.querySelector(query); 652 | if(input)input.placeholder = text; 653 | } 654 | function titlesReplace(query,dictionaries) { 655 | let elements = document.querySelectorAll(query); 656 | if(elements && elements.length){ 657 | elements.forEach(function (element) { 658 | if(element){ 659 | if(element.title){ 660 | let key = trim(element.title); 661 | if(key&&dictionaries[key]){ 662 | element.title = element.title.replace(key,dictionaries[key]); 663 | } 664 | } 665 | } 666 | }) 667 | } 668 | } 669 | 670 | 671 | var className = { 672 | "artistcg" :"画师集", 673 | "cosplay" :"COSPLAY", 674 | "doujinshi":"同人本", 675 | "gamecg" :"游戏CG", 676 | "imageset" :"图集", 677 | "manga" :"漫画", 678 | "misc" :"杂项", 679 | "non-h" :"非H", 680 | "western" :"西方", 681 | "asianporn":"亚洲" 682 | }; 683 | 684 | 685 | var translator = {}; 686 | 687 | /*公共*/ 688 | translator.public = function () { 689 | routineTextReplace('#nb a,.ip a,#frontpage a',{ 690 | "Front Page":"首页", 691 | "Torrents":"种子", 692 | "Watched": "关注", 693 | "Popular": "流行", 694 | "Favorites":"收藏", 695 | "My Uploads":"我的上传", 696 | "My Tags":"我的标签", 697 | "Settings":"设置", 698 | "My Galleries":"我的画廊", 699 | "My Home":"我的首页", 700 | "Toplists":"排行榜", 701 | "Bounties":"悬赏", 702 | "News":"新闻", 703 | "Forums":"论坛", 704 | "Wiki":"维基", 705 | "HentaiVerse":"HV游戏", 706 | }); 707 | titlesReplace(".ygm",{ 708 | "Contact Poster":"联系发帖人", 709 | "Contact Uploader":"联系上传者", 710 | }); 711 | 712 | localRoutineReplace('#iw p',{ 713 | "You do not have any watched tags. You can change your watched tags from ":"你没有任何关注的标签,你可以修改她->" 714 | }); 715 | localRoutineReplace('#iw a',{ 716 | "My Tags":"我的标签" 717 | }); 718 | 719 | }; 720 | 721 | /*画廊页*/ 722 | translator.gallery = function () { 723 | routineReplace('.gdt1',{ 724 | "Posted:":"添加时间:", 725 | "Parent:":"父级:", 726 | "Visible:":"可见:", 727 | "Language:":"语言:", 728 | "File Size:":"体积:", 729 | "Length:":"页数:", 730 | "Favorited:":"收藏:", 731 | }); 732 | routineReplace('.gdt2',{ 733 | "Yes":"是", 734 | "No":"否", 735 | "None":"无", 736 | }); 737 | localRoutineReplace('.gdt2',{ 738 | "times":"次", 739 | "pages":"页", 740 | "Japanese":"日文", 741 | "English":"英文", 742 | "Chinese":"中文", 743 | "Dutch":"荷兰语", 744 | "French":"法语", 745 | "German":"德语", 746 | "Hungarian":"匈牙利", 747 | "Italian":"意呆利", 748 | "Korean":"韩语", 749 | "Polish":"波兰语", 750 | "Portuguese":"葡萄牙语", 751 | "Russian":"俄语", 752 | "Spanish":"西班牙语", 753 | "Thai":"泰语", 754 | "Vietnamese":"越南语", 755 | }); 756 | routineReplace('#grt1',{ 757 | "Rating:":"评分:", 758 | }); 759 | routineReplace('#favoritelink',{ 760 | "Add to Favorites":"添加收藏", 761 | }); 762 | AddGlobalStyle(`.tc{ white-space:nowrap; }`); 763 | routineReplace('.tc',{ 764 | "artist:":"艺术家:", 765 | "character:":"角色:", 766 | "female:":"女性:", 767 | "group:":"团队:", 768 | "language:":"语言:", 769 | "male:":"男性:", 770 | "misc:":"杂项:", 771 | "parody:":"原作:", 772 | "reclass:":"重新分类:" 773 | }); 774 | localRoutineReplace('#gd5 p',{ 775 | "Report Gallery":"举报画廊", 776 | "Archive Download":"打包下载", 777 | "Petition to Expunge":"请求删除", 778 | "Petition to Rename":"请求重命名", 779 | "Torrent Download":"种子下载", 780 | "Show Gallery Stats":"画廊状态", 781 | }); 782 | routineReplace('#gdo4 div',{ 783 | "Normal":"小图", 784 | "Large":"大图", 785 | }); 786 | localRoutineReplace('#gdo2 div',{ 787 | "rows":"行" 788 | }); 789 | routineReplace('#cdiv .c4',{ 790 | "Uploader Comment":"上传者评论", 791 | }); 792 | routineReplace('#cdiv .c4 a',{ 793 | "Vote+":"支持", 794 | "Vote-":"反对" 795 | }); 796 | 797 | localRoutineReplace('.gpc',{ 798 | "Showing":"当前页面显示图片为", 799 | "of":"共", 800 | "images":"张" 801 | }); 802 | 803 | localRoutineReplace('#eventpane p',{ 804 | "It is the dawn of a new day!":"新的一天开始啦", 805 | "Reflecting on your journey so far, you find that you are a little wiser." 806 | :"到目前为止,你的旅程展示出了你的聪慧", 807 | "You gain":"你获得了", 808 | "EXP":"经验", 809 | "Credits":"积分(C)", 810 | }); 811 | 812 | localRoutineReplace('#rating_label',{ 813 | "Average:":"平均:" 814 | }); 815 | 816 | routineReplace('#postnewcomment a',{ 817 | "Post New Comment":"发表评论", 818 | }); 819 | 820 | 821 | inputPlaceholder("#newtagfield","新增标签: 输入新的标签,用逗号分隔"); 822 | 823 | titlesReplace(".gdt2 .halp",{ 824 | "This gallery has been translated from the original language text.":"这个画廊已从原文翻译过来了。" 825 | }); 826 | 827 | let rating_label = document.querySelector('#rating_label'); 828 | if(rating_label){ 829 | //监听评分显示DOM变化 触发替换内容 830 | let observer = new MutationObserver(function(mutations) { 831 | for(let i in mutations){ 832 | for(let n in mutations[i].addedNodes){ 833 | let node = mutations[i].addedNodes[n]; 834 | if(node.nodeName == "#text"){ 835 | node.textContent = node.textContent.replace("Average:","平均:"); 836 | node.textContent = node.textContent.replace("Rate as","打分"); 837 | node.textContent = node.textContent.replace("stars","星"); 838 | } 839 | } 840 | } 841 | }); 842 | observer.observe(rating_label, {childList:true}); 843 | } 844 | 845 | 846 | var tagmenu_act = document.querySelector("#tagmenu_act"); 847 | if(tagmenu_act){ 848 | let linkBoxPlaceObserver = new MutationObserver(function(mutations) { 849 | for(var i in mutations){ 850 | let mutation = mutations[i]; 851 | if(mutation.type == "childList" && mutation.addedNodes.length>=2){ 852 | routineReplace('#tagmenu_act a',{ 853 | "Vote Up":"支持标签", 854 | "Vote Down":"反对标签", 855 | "Withdraw Vote":"撤销投票", 856 | "Show Tagged Galleries":"搜索标签", 857 | "Show Tag Definition":"标签简介", 858 | "Add New Tag":"添加新标签", 859 | }); 860 | } 861 | } 862 | }); 863 | linkBoxPlaceObserver.observe(tagmenu_act, {childList: true}); 864 | } 865 | 866 | 867 | }; 868 | /*种子下载页面*/ 869 | translator.torrent = function () { 870 | routineReplace('#torrentinfo td span', { 871 | "Posted:" : "上传时间:", 872 | "Size:" : "体积:", 873 | "Seeds:" : "种源数:", 874 | "Peers:" : "下载中:", 875 | "Downloads:": "下载次数:", 876 | "Uploader:" : "上传者:", 877 | }); 878 | }; 879 | 880 | /*用户设置页面*/ 881 | translator.settings = function () { 882 | routineReplace('#outer h1',{ 883 | "Settings":"设置" 884 | }); 885 | routineReplace('#outer h2',{ 886 | "Image Load Settings":"图像加载设置", 887 | "Image Size Settings":"图像大小的设置", 888 | "Gallery Name Display":"画廊的名字显示", 889 | "Archiver Settings":"归档设置", 890 | "Front Page Settings":"首页设置", 891 | "Favorites":"收藏", 892 | "Ratings":"评分", 893 | "Tag Namespaces":"标签组", 894 | "Excluded Languages":"排除语言", 895 | "Search Result Count":"搜索结果数", 896 | "Thumbnail Settings":"缩略图设置", 897 | "Gallery Comments":"画廊评论", 898 | "Gallery Tags":"画廊标签", 899 | "Gallery Page Numbering":"画廊页面页码", 900 | "Hentai@Home Local Network Host":"Hentai@Home本地网络服务器" 901 | }); 902 | routineReplace('.optmain p',{ 903 | "Do you wish to load images through the Hentai@Home Network, if available?" 904 | :"是否希望通过 Hentai@Home 网路加载资源, 如果可以?", 905 | "Normally, images are resampled to 1280 pixels of horizontal resolution for online viewing. You can alternatively select one of the following resample resolutions." 906 | :"通常情况,图像将重采样到1280像素宽度以用于在线浏览,您也可以选择以下重新采样分辨率。", 907 | "To avoid murdering the staging servers, resolutions above 1280x are temporarily restricted to donators, people with any hath perk, and people with a UID below 3,000,000." 908 | :"但是为了避免负载过高,高于1280像素将只供给于赞助者、特殊贡献者,以及UID小于3,000,000的用户", 909 | "While the site will automatically scale down images to fit your screen width, you can also manually restrict the maximum display size of an image. Like the automatic scaling, this does not resample the image, as the resizing is done browser-side. (0 = no limit)" 910 | :"虽然图片会自动根据窗口缩小,你也可以手动设置最大大小,图片并没有重新采样(0为不限制)", 911 | "Many galleries have both an English/Romanized title and a title in Japanese script. Which gallery name would you like to see as default?" 912 | :"很多画廊都同时拥有英文或者日文标题,你想默认显示哪一个?", 913 | "The default behavior for the Archiver is to confirm the cost and selection for original or resampled archive, then present a link that can be clicked or copied elsewhere. You can change this behavior here." 914 | :"默认归档下载方式为手动选择(原画质或压缩画质),然后手动改复制或点击下载链接,你可以修改归档下载方式", 915 | "Which display mode would you like to use on the front and search pages?" 916 | :"你想在搜索页面显示哪种样式?", 917 | "What categories would you like to view as default on the front page?" 918 | :"你希望在首页上看到哪些类别?", 919 | "Here you can choose and rename your favorite categories." 920 | :"在这里你可以重命名你得收藏夹", 921 | "You can also select your default sort order for galleries on your favorites page. Note that favorites added prior to the March 2016 revamp did not store a timestamp, and will use the gallery posted time regardless of this setting." 922 | :"你也可以选择收藏夹中默认排序.请注意,2016年3月改版之前加入收藏夹的画册并未保存收藏时间,会以画册发布时间代替.", 923 | "By default, galleries that you have rated will appear with red stars for ratings of 2 stars and below, green for ratings between 2.5 and 4 stars, and blue for ratings of 4.5 or 5 stars. You can customize this by entering your desired color combination below." 924 | :"默认情况,被你评分的画册,2星以下显示红色,2.5星到4星显示绿色,4.5到5星显示蓝色. 你可以在下面输入自己所需的颜色组合.", 925 | "If you want to exclude certain namespaces from a default tag search, you can check those below. Note that this does not prevent galleries with tags in these namespaces from appearing, it just makes it so that when searching tags, it will forego those namespaces." 926 | :"如果要从默认标签搜索中排除某些标签组,可以检查以下内容。 请注意,这不会阻止在这些标签组中的标签的展示区出现,它只是在搜索标签时排除这些标签组。", 927 | "If you wish to hide galleries in certain languages from the gallery list and searches, select them from the list below." 928 | :"如果您希望以图库列表中的某些语言隐藏画廊并进行搜索,请从下面的列表中选择它们。", 929 | "Note that matching galleries will never appear regardless of your search query." 930 | :"请注意,无论搜索查询如何,匹配的图库都不会出现。", 931 | "How many results would you like per page for the index/search page and torrent search pages? (Hath Perk: Paging Enlargement Required)" 932 | :"搜索页面每页显示多少条数据? (Hath Perk:付费扩展)", 933 | "How would you like the mouse-over thumbnails on the front page to load when using List Mode?" 934 | :"你希望鼠标悬停缩略图何时加载?", 935 | "You can set a default thumbnail configuration for all galleries you visit." 936 | :"画廊页面缩略图设置", 937 | "Sort order for gallery comments:" 938 | :"评论排序方式:", 939 | "Show gallery comment votes:" 940 | :"显示评论投票数:", 941 | "Sort order for gallery tags:" 942 | :"图库标签排序方式:", 943 | "Show gallery page numbers:" 944 | :"显示画廊页码:", 945 | "This setting can be used if you have a H@H client running on your local network with the same public IP you browse the site with. Some routers are buggy and cannot route requests back to its own IP; this allows you to work around this problem." 946 | :"如果你本地安装了H@H客户端,本地ip与浏览网站的公共ip相同,一些路由器不支持回流导致无法访问到自己,你可以设置这里来解决", 947 | "If you are running the client on the same PC you browse from, use the loopback address (127.0.0.1:port). If the client is running on another computer on your network, use its local network IP. Some browser configurations prevent external web sites from accessing URLs with local network IPs, the site must then be whitelisted for this to work." 948 | :"如果在同一台电脑上访问网站和运行客户端,请使用本地回环地址(127.0.0.1:端口号). 如果客户端在网络上的其他计算机运行,请使用那台机器的内网ip. 某些浏览器的配置可能阻止外部网站访问本地网络,你必须将网站列入白名单才能工作." 949 | }); 950 | routineReplace('.optmain label',{ 951 | "Yes (Recommended)" 952 | : "是 (推荐)", 953 | "No (You will not be able to browse as many pages. Enable only if having problems.)" 954 | : "不 (你将无法一次浏览多页,请只有在出问题的时候启动此功能.)", 955 | "Auto": "自动", 956 | "Default Title": "默认标题", 957 | "Japanese Title (if available)": "日文标题 (如果可用)", 958 | "Manual Select, Manual Start (Default)": "手动选择,手动下载 (默认)", 959 | "Manual Select, Auto Start": "手动选择,自动下载", 960 | "Auto Select Original, Manual Start": "自动选择原始画质,手动下载", 961 | "Auto Select Original, Auto Start": "自动选择原始画质,自动下载", 962 | "Auto Select Resample, Manual Start": "自动选择压缩画质,手动下载", 963 | "Auto Select Resample, Auto Start": "自动选择压缩画质,自动下载", 964 | "List View": "列表视图", 965 | "Thumbnail View": "缩略图视图", 966 | "By last gallery update time": "以最新的画册更新时间排序", 967 | "By favorited time": "以收藏时间排序", 968 | "artist":"艺术家", 969 | "character":"角色", 970 | "female":"女性", 971 | "group":"团队", 972 | "language":"语言", 973 | "male":"男性", 974 | "misc":"杂项", 975 | "parody":"原作", 976 | "reclass":"重新分类", 977 | "25 results": "25个", 978 | "50 results": "50个", 979 | "100 results": "100个", 980 | "200 results": "200个", 981 | "On mouse-over (pages load faster, but there may be a slight delay before a thumb appears)" 982 | : "鼠标悬停时 (页面加载快,缩略图加载有延迟)", 983 | "On page load (pages take longer to load, but there is no delay for loading a thumb after the page has loaded)" 984 | : "页面加载时 (页面加载时间更长,但是显示的时候无需等待)", 985 | "Normal": "小图", 986 | "Large": "大图", 987 | "Oldest comments first": "最早的评论", 988 | "Recent comments first": "最新的评论", 989 | "By highest score": "分数最高", 990 | "On score hover or click": "悬停或点击时", 991 | "Always": "总是", 992 | "Alphabetical": "按字母排序", 993 | "By tag power": "按标签权重", 994 | "No": "否", 995 | "Yes": "是" 996 | }); 997 | 998 | routineReplace('.optmain #ru2',{ 999 | "Each letter represents one star. The default RRGGB means R(ed) for the first and second star, G(reen) for the third and fourth, and B(lue) for the fifth. You can also use (Y)ellow for the normal stars. Any five-letter combination of R, G, B and Y will work." 1000 | :"每个字母代表一个星,默认是 RRGGB ,第1和2是红色,第3和4是绿色,第5个为蓝色, \n你可以使用 R:红色 G:绿色 B:蓝色 Y:黄色 任何5位组合都是有效的.", 1001 | }); 1002 | 1003 | routineReplace('.optmain .optsub td,.optmain .optsub th',{ 1004 | "Size:":"大小:", 1005 | "Rows:":"行数:", 1006 | "Horizontal:":"宽:", 1007 | "Vertical:":"高:", 1008 | "pixels":"像素", 1009 | "Original":"原始语言", 1010 | "Translated":"翻译版", 1011 | "Rewrite":"改编版", 1012 | "All":"所有", 1013 | "Japanese":"日文", 1014 | "English":"英文", 1015 | "Chinese":"中文", 1016 | "Dutch":"荷兰语", 1017 | "French":"法语", 1018 | "German":"德语", 1019 | "Hungarian":"匈牙利", 1020 | "Italian":"意呆利", 1021 | "Korean":"韩语", 1022 | "Polish":"波兰语", 1023 | "Portuguese":"葡萄牙语", 1024 | "Russian":"俄语", 1025 | "Spanish":"西班牙语", 1026 | "Thai":"泰语", 1027 | "Vietnamese":"越南语", 1028 | "N/A":"无效", 1029 | "Other":"其他", 1030 | }); 1031 | 1032 | inputReplace('#apply input[type=submit]','应用'); 1033 | routineReplace('#msg',{ 1034 | "Settings were updated":"设置已更新", 1035 | }); 1036 | 1037 | 1038 | 1039 | 1040 | }; 1041 | 1042 | translator.home = function () { 1043 | routineReplace('#toppane h1.ih',{ 1044 | "E-Hentai Galleries: The Free Hentai Doujinshi, Manga and Image Gallery System":"E-Hentai E绅士画廊:一个免费的绅士漫画、同人志和图片系统", 1045 | "ExHentai.org - The X Makes It Sound Cool":"ExHentai.org - X使它听起来很酷 ", 1046 | }); 1047 | inputPlaceholder("#searchbox input[name=f_search]","搜索关键词"); 1048 | inputReplace("#searchbox input[name=f_apply]","搜索"); 1049 | inputReplace("#searchbox input[name=f_clear]","清空"); 1050 | 1051 | routineReplace('#searchbox .nopm a',{ 1052 | "Show Advanced Options":"显示高级选项", 1053 | "Show File Search":"显示文件搜索", 1054 | }); 1055 | localRoutineReplace('#dmo',{ 1056 | "Display:":"视图:", 1057 | "Show ":"显示", 1058 | "List":"列表", 1059 | "Thumbnails":"缩略图" 1060 | }) 1061 | routineReplace('.itg th',{ 1062 | "Published":"发布时间", 1063 | "Name":"名称", 1064 | "Uploader":"上传者" 1065 | }); 1066 | 1067 | routineReplace("#pt",{"Popular Right Now":"当下流行"}); 1068 | 1069 | localRoutineReplace('.id42',{ 1070 | "files":"张" 1071 | }); 1072 | 1073 | 1074 | 1075 | let itc = document.querySelector('#searchbox .itc'); 1076 | if(itc){ 1077 | //监听评分显示DOM变化 触发替换内容 1078 | var observer = new MutationObserver(function(mutations) { 1079 | mutations.forEach(function (mutation) { 1080 | if(mutation.type == "attributes" && mutation.attributeName == "value"){ 1081 | let input = mutation.target; 1082 | input.parentNode.className = input.value*1?"":"icon_disable"; 1083 | } 1084 | }); 1085 | }); 1086 | observer.observe(itc, {childList: true, subtree: true, attributes: true}); 1087 | } 1088 | 1089 | let itc_inputs = document.querySelectorAll('#searchbox .itc td input'); 1090 | if(itc_inputs)itc_inputs.forEach(function (input) { 1091 | input.parentNode.className = input.value*1?"":"icon_disable"; 1092 | }); 1093 | }; 1094 | 1095 | 1096 | /*ui翻译路由*/ 1097 | translator.public(); 1098 | translator.home(); 1099 | if(hrefTest(/exhentai\.org\/g\/|e-hentai\.org\/g\//))translator.gallery(); 1100 | if(hrefTest(/gallerytorrents\.php/))translator.torrent(); 1101 | if(hrefTest(/uconfig\.php/))translator.settings(); 1102 | 1103 | } 1104 | 1105 | //UI控制方法等等 1106 | function EhTagBuilder(){ 1107 | console.log('EhTagBuilder'); 1108 | 1109 | var buttonInserPlace = document.querySelector(".pagehead-actions");//按钮插入位置 1110 | var li = document.createElement("li"); 1111 | li.id = 'etb'; 1112 | li.setAttribute('ng-csp','ng-csp'); 1113 | li.innerHTML = GM_getResourceText('template'); 1114 | var app = angular.module("etb",[]); 1115 | app.controller("etb",function($rootScope,$scope,$location,$anchorScroll){ 1116 | // console.log(); 1117 | $scope.pluginVersion = pluginVersion; 1118 | $scope.pluginName = pluginName; 1119 | 1120 | $scope.nowConfig = etbConfig; 1121 | //编辑用的配置拷贝一份 1122 | $scope.config = JSON.parse(JSON.stringify(etbConfig)); 1123 | 1124 | $scope.nowPage = "menu"; 1125 | $scope.menuShow = false; 1126 | rootScope = $rootScope; 1127 | $scope.dataset = false; 1128 | $scope.wikiVersion = false; 1129 | 1130 | var backdrop = document.querySelector(".modal-backdrop"); 1131 | if(backdrop)backdrop.addEventListener('click',function(){ 1132 | $scope.closeMenu(); 1133 | $scope.$apply(); 1134 | }); 1135 | 1136 | 1137 | //xx时间前转换方法 1138 | $scope.timetime = timeInterval; 1139 | //打开菜单按钮 1140 | $scope.openMenu = function () { 1141 | $scope.nowPage = "menu"; 1142 | $scope.menuShow = true; 1143 | }; 1144 | //关闭菜单按钮 1145 | $scope.closeMenu = function () { 1146 | $scope.menuShow = false; 1147 | }; 1148 | //开始获取 1149 | $scope.startProgram = async function () { 1150 | $scope.nowPage = "getData"; 1151 | await startProgram($scope); 1152 | //增加一个延迟 因为处理css时候会卡住 导致加载完毕的ui无法显示 1153 | setTimeout(function(){ 1154 | var css = buildCSS($scope.dataset,$scope.wikiVersion); 1155 | // 存储 1156 | $scope.css = css; 1157 | $scope.cssStylish = buildStylishCSS(css,$scope.nowConfig); 1158 | $scope.nowPage = 'css'; 1159 | $scope.$apply(); 1160 | },0); 1161 | }; 1162 | //存储css样式 1163 | $scope.saveCss = function () { 1164 | GM_setValue('tags',{ 1165 | css:$scope.css, 1166 | data:$scope.dataset, 1167 | map:tagsIndexes($scope.dataset), 1168 | version:$scope.wikiVersion, 1169 | update_time:new Date().getTime() 1170 | }); 1171 | myNotification('保存完毕'); 1172 | }; 1173 | 1174 | $scope.copyStylishCss = function () { 1175 | GM_setClipboard($scope.cssStylish) 1176 | myNotification('复制完毕'); 1177 | }; 1178 | $scope.copyCss = function () { 1179 | GM_setClipboard($scope.css) 1180 | myNotification('复制完毕'); 1181 | }; 1182 | 1183 | //打开设置界面 1184 | $scope.openOption = function () { 1185 | $scope.nowPage = "option"; 1186 | }; 1187 | $scope.ariaConfig = function () { 1188 | $scope.nowPage = "ariaOptions"; 1189 | }; 1190 | 1191 | $scope.optionChange = function (d1, d2) { 1192 | return JSON.stringify(d1) == JSON.stringify(d2); 1193 | }; 1194 | 1195 | //保存设置 1196 | $scope.optionSave = function () { 1197 | $scope.nowConfig = etbConfig = JSON.parse(JSON.stringify($scope.config)); 1198 | GM_setValue('config',etbConfig); 1199 | myNotification('保存成功'); 1200 | 1201 | }; 1202 | //重置设置 1203 | $scope.optionReset = function () { 1204 | if(confirm('确定要重置配置吗?')){ 1205 | $scope.nowConfig = etbConfig = JSON.parse(JSON.stringify(defaultConfig)); 1206 | $scope.config = JSON.parse(JSON.stringify(defaultConfig)); 1207 | GM_setValue('config',etbConfig); 1208 | myNotification('已重置'); 1209 | } 1210 | }; 1211 | 1212 | $rootScope.$on('$locationChangeSuccess', function(event){ 1213 | if( $location.path() == "/ets-open-option" ){ 1214 | $scope.openMenu(); 1215 | $scope.openOption(); 1216 | $anchorScroll('etb') 1217 | $location.path("/"); 1218 | } 1219 | if( $location.path() == "/ets-open-menu" ){ 1220 | $scope.openMenu(); 1221 | $anchorScroll('etb') 1222 | $location.path("/"); 1223 | } 1224 | if( $location.path() == "/ets-auto-update" ){ 1225 | $scope.openMenu(); 1226 | $scope.startProgram().then(function () { 1227 | $scope.saveCss(); 1228 | }) 1229 | $anchorScroll('etb'); 1230 | $location.path("/"); 1231 | } 1232 | if( $location.path() == "/ets-set-config" ){ 1233 | let s = $location.search(); 1234 | for(var i in s){ 1235 | var v = s[i]; 1236 | if(v === 'true'){ 1237 | v = true; 1238 | } 1239 | if(v === 'false'){ 1240 | v = false; 1241 | } 1242 | etbConfig[i] = v; 1243 | } 1244 | GM_setValue('config',etbConfig); 1245 | myNotification('配置已修改',{body:JSON.stringify(s)}); 1246 | $location.path("/").search({}); 1247 | } 1248 | 1249 | if( $location.path() == "/ets-reset-config" ){ 1250 | $scope.optionReset(); 1251 | $location.path("/"); 1252 | } 1253 | }); 1254 | 1255 | }); 1256 | angular.bootstrap(li,['etb']); 1257 | // unsafeWindow.etbApp = app; 1258 | buttonInserPlace.insertBefore(li,buttonInserPlace.querySelector("li")); 1259 | console.log('EhTagBuilder loaded') 1260 | } 1261 | 1262 | //样式写入方法 enema syringe 1263 | function EhTagSyringe(){ 1264 | console.time('EhTagSyringe Load Enema'); 1265 | let tags = tagsData; 1266 | console.timeEnd('EhTagSyringe Load Enema'); 1267 | if(!tags) { 1268 | AddGlobalStyle(baseStyle.public); 1269 | return; 1270 | } 1271 | 1272 | console.time('EhTagSyringe Infusion'); 1273 | unsafeWindow.tags = tags; 1274 | AddGlobalStyle(tags.css); 1275 | AddGlobalStyle(baseStyle.public); 1276 | 1277 | if((/(exhentai\.org)/).test(unsafeWindow.location.href)){ 1278 | AddGlobalStyle(baseStyle.ex); 1279 | } 1280 | if((/(e-hentai\.org)/).test(unsafeWindow.location.href)){ 1281 | AddGlobalStyle(baseStyle.eh); 1282 | } 1283 | 1284 | //临时隐藏翻译用的样式 1285 | AddGlobalStyle(` 1286 | .hideTranslate #taglist a{font-size:12px !important;} 1287 | .hideTranslate #taglist a::before{display:none !important;} 1288 | .hideTranslate #taglist a::after{display:none !important;} 1289 | `); 1290 | 1291 | AddGlobalStyle(` 1292 | `); 1293 | 1294 | console.timeEnd('EhTagSyringe Infusion'); 1295 | } 1296 | 1297 | function EhTagSyringeLink() { 1298 | let taglist = document.querySelector("#taglist"); 1299 | var linkBoxPlace = document.querySelector("#tagmenu_act"); 1300 | var linkBox = document.createElement("div"); 1301 | linkBox.id = "TES-link-box"; 1302 | linkBox.style.marginBottom='5px'; 1303 | console.log(tagsData); 1304 | let tags = tagsData.data; 1305 | let map = tagsData.map||{}; 1306 | console.log('map',map); 1307 | // document.body.appendChild(linkBox); 1308 | AddGlobalStyle(`div#tagmenu_act{height:auto}`); 1309 | if(!linkBoxPlace){ 1310 | return; 1311 | } 1312 | 1313 | linkBoxPlace.insertBefore(linkBox,linkBoxPlace.childNodes[0]); 1314 | function getTag(r, i) { 1315 | r = r.replace(/_/igm," "); 1316 | i = i.replace(/_/igm," "); 1317 | let mr = map[r]; 1318 | return tags[mr.index].tags[mr.tags[i]]; 1319 | } 1320 | 1321 | if(taglist&&linkBoxPlace){ 1322 | let linkBoxPlaceObserver = new MutationObserver(function(mutations) { 1323 | // console.log('linkBoxPlaceObserver',mutations); 1324 | for(var i in mutations){ 1325 | let mutation = mutations[i]; 1326 | if(mutation.type == "childList" && mutation.addedNodes.length>=2){ 1327 | linkBoxPlace.insertBefore(linkBox,linkBoxPlace.childNodes[0]); 1328 | } 1329 | } 1330 | }); 1331 | linkBoxPlaceObserver.observe(linkBoxPlace, {childList: true}); 1332 | 1333 | let observer = new MutationObserver(function(mutations) { 1334 | console.log('taglist_a',mutations); 1335 | linkBox.innerHTML=""; 1336 | for(let i in mutations){ 1337 | let mutation = mutations[i]; 1338 | if(mutation.type == 'attributes' && mutation.attributeName == 'style'){ 1339 | let a = mutation.target; 1340 | if(a.style.color == 'blue'){ 1341 | let keys = a.id.replace('ta_','').split(':'); 1342 | if(keys.length == 2){ 1343 | let tag = getTag(keys[0],keys[1]); 1344 | if(tag&&tag.links){ 1345 | tag.links.forEach(function (a) { 1346 | linkBox.innerHTML +=` > ${a.title} ` 1347 | }) 1348 | } 1349 | } 1350 | } 1351 | } 1352 | } 1353 | }); 1354 | observer.observe(taglist, {childList: true, subtree: true, attributes: true}); 1355 | 1356 | 1357 | } 1358 | } 1359 | 1360 | //EH站更新提示 1361 | function EhTagVersion(){ 1362 | console.log('EhTagVersion'); 1363 | var buttonInserPlace = document.querySelector("#nb"); //按钮插入位置 1364 | if(!buttonInserPlace)return; 1365 | 1366 | var span = document.createElement("span"); 1367 | var iconImg = "https://exhentai.org/img/mr.gif"; 1368 | 1369 | 1370 | if((/(exhentai\.org)/).test(unsafeWindow.location.href)){ 1371 | iconImg="https://ehgt.org/g/mr.gif"; 1372 | span.className=span.className+" isEX"; 1373 | } 1374 | var etsPrompt = GM_getResourceText('ets-prompt'); 1375 | // etsPrompt = ``; 1376 | 1377 | span.innerHTML = `${etsPrompt}`; 1378 | 1379 | var app = angular.module("etb",[]); 1380 | app.controller("etb",function($rootScope,$scope){ 1381 | $scope.pluginVersion = pluginVersion; 1382 | $scope.pluginName = pluginName; 1383 | $scope.iconImg = iconImg; 1384 | $scope.config = etbConfig; 1385 | $scope.noData = false; 1386 | let tags = tagsData; 1387 | if(!tags){ 1388 | $scope.noData =true; 1389 | } 1390 | $scope.nowPage = ""; 1391 | $scope.menuShow = false; 1392 | rootScope = $rootScope; 1393 | $scope.dataset = false; 1394 | $scope.wikiVersion = {}; 1395 | if(tags){ 1396 | $scope.wikiVersion = tags.version; 1397 | $scope.update_time = tags.update_time; 1398 | } 1399 | $scope.hide = false; 1400 | //xx时间前转换方法 1401 | $scope.timetime = timeInterval; 1402 | //打开菜单按钮 1403 | $scope.openMenu = function () { 1404 | console.log('openMenu'); 1405 | $scope.nowPage = "menu"; 1406 | $scope.menuShow = !$scope.menuShow; 1407 | }; 1408 | $scope.showRow = {}; 1409 | $scope.showRow.value = false; 1410 | $scope.showRow.double = !!$scope.config.doubleLang; 1411 | $scope.showRow.change = function(value){ 1412 | if ($scope.showRow.value) 1413 | { 1414 | document.body.classList.add("hideTranslate"); 1415 | }else 1416 | document.body.classList.remove("hideTranslate"); 1417 | if($scope.showRow.double) 1418 | { 1419 | document.body.classList.add("doubleLang"); 1420 | }else 1421 | document.body.classList.remove("doubleLang"); 1422 | }; 1423 | $scope.showRow.change(); 1424 | 1425 | $scope.VersionCheck = function () { 1426 | getWikiVersion().then(function (Version) { 1427 | $scope.lastVersionCheck = { 1428 | time:new Date().getTime(), 1429 | version:Version, 1430 | }; 1431 | GM_setValue('lastVersionCheck',$scope.lastVersionCheck); 1432 | $scope.newVersion = Version; 1433 | $scope.$apply(); 1434 | 1435 | //这是个秘密 1436 | if(etbConfig.autoUpdate){ 1437 | if($scope.newVersion.code != $scope.wikiVersion.code){ 1438 | autoUpdate().then(function () { 1439 | myNotification('更新完毕,刷新页面生效'); 1440 | }); 1441 | } 1442 | } 1443 | console.log(Version); 1444 | }); 1445 | }; 1446 | 1447 | let lastVersionCheck = GM_getValue('lastVersionCheck'); 1448 | $scope.lastVersionCheck = lastVersionCheck; 1449 | if(!lastVersionCheck){ 1450 | console.log('auto VersionCheck1'); 1451 | $scope.VersionCheck(); 1452 | }else{ 1453 | $scope.newVersion = lastVersionCheck.version; 1454 | //限制20分钟检查一次版本 1455 | if(new Date().getTime() - lastVersionCheck.time > 20*60*1000 ){ 1456 | console.log('auto VersionCheck'); 1457 | $scope.VersionCheck(); 1458 | } 1459 | } 1460 | unsafeWindow.r = function () { 1461 | $scope.$apply(); 1462 | }; 1463 | }); 1464 | angular.bootstrap(span,['etb']); 1465 | unsafeWindow.etsApp = app; 1466 | 1467 | buttonInserPlace.appendChild(span); 1468 | } 1469 | 1470 | //搜索输入框助手 1471 | function EhTagInputHelper(){ 1472 | if(!etbConfig.searchHelper){ 1473 | return; 1474 | } 1475 | let tags = tagsData; 1476 | // console.log(tags); 1477 | if(!tags)return; 1478 | 1479 | console.time('add datalist'); 1480 | let stdinput = document.querySelector('#searchbox input[name=f_search]') || document.querySelector('#newtagfield'); 1481 | if(!stdinput){return} 1482 | stdinput.setAttribute("list", "tbs-tags"); 1483 | 1484 | var datalist = document.createElement("datalist"); 1485 | datalist.setAttribute("id", "tbs-tags"); 1486 | stdinput.parentNode.insertBefore(datalist,stdinput.nextSibling); 1487 | 1488 | 1489 | //调整加载顺序 作家在前面影响搜索 1490 | let loadOrder = [ 1491 | 'female', 1492 | 'male', 1493 | 'language', 1494 | 'character', 1495 | 'reclass', 1496 | 'misc', 1497 | 'parody', 1498 | 'artist' 1499 | ]; 1500 | var tagsk = {}; 1501 | tags.data.forEach(function (row) { 1502 | tagsk[row.name] = row; 1503 | }); 1504 | loadOrder.forEach(function (key) { 1505 | let row = tagsk[key]; 1506 | let type = row.name; 1507 | let typeName = row.cname; 1508 | row.tags.forEach(function (tag) { 1509 | if(tag.name){ 1510 | let z = document.createElement("OPTION"); 1511 | z.setAttribute("value", `${type}:"${tag.name}$"`); 1512 | z.setAttribute("label", `${typeName}:${mdImg2cssImg(tag.cname,0)}`); 1513 | datalist.appendChild(z); 1514 | } 1515 | }); 1516 | }) 1517 | 1518 | 1519 | console.timeEnd('add datalist'); 1520 | 1521 | 1522 | } 1523 | 1524 | //磁力链复制助手 1525 | function EhTagMagnetHelper(){ 1526 | if(!(/gallerytorrents\.php/).test(unsafeWindow.location.href)){ 1527 | return; 1528 | } 1529 | console.log('EhTagMagnetHelper'); 1530 | 1531 | let tableList = document.querySelectorAll("#torrentinfo form table"); 1532 | 1533 | if(tableList&&tableList.length)tableList.forEach(function (table) { 1534 | console.log(table); 1535 | 1536 | let href = ''; 1537 | let a = table.querySelector('a'); 1538 | if(a)href = a.href; 1539 | if(!href)return; 1540 | 1541 | let magnet = href.replace(/.*?([0-9a-f]{40}).*$/i,"magnet:?xt=urn:btih:$1") ; 1542 | if(magnet.length != 60)return; 1543 | 1544 | let insertionPoint = table.querySelector('input'); 1545 | if(!insertionPoint)return; 1546 | 1547 | var button = document.createElement("input"); 1548 | button.type = "button"; 1549 | button.value = "复制磁力链"; 1550 | button.className = 'stdbtn'; 1551 | button.onclick = function () { 1552 | GM_setClipboard(magnet); 1553 | myNotification('复制成功',{ 1554 | body:magnet 1555 | }); 1556 | }; 1557 | console.log(magnet); 1558 | 1559 | 1560 | // let parent = ; 1561 | insertionPoint.parentNode.insertBefore( button, insertionPoint ); 1562 | }) 1563 | 1564 | 1565 | 1566 | 1567 | 1568 | 1569 | } 1570 | 1571 | //小米路由下载助手 1572 | function EhTagMiWifi() { 1573 | if (!(/gallerytorrents\.php/).test(unsafeWindow.location.href)) { 1574 | return; 1575 | } 1576 | console.log('EhTagMiWifi'); 1577 | let tableList = document.querySelectorAll("#torrentinfo form table"); 1578 | if (tableList && tableList.length) tableList.forEach(function (table) { 1579 | let href = ''; 1580 | let a = table.querySelector('a'); 1581 | if (a) href = a.href; 1582 | if (!href) return; 1583 | 1584 | let magnet = href.replace(/.*?([0-9a-f]{40}).*$/i, "magnet:?xt=urn:btih:$1"); 1585 | if (magnet.length != 60) return; 1586 | 1587 | let insertionPoint = table.querySelector('input'); 1588 | if (!insertionPoint) return; 1589 | 1590 | var button = document.createElement("input"); 1591 | button.type = "button"; 1592 | button.value = "下载到小米路由器"; 1593 | button.className = 'stdbtn'; 1594 | button.onclick = function () { 1595 | unsafeWindow.resizeTo(1000, 600); 1596 | unsafeWindow.location.href = `https://d.miwifi.com/d2r/?url=${btoa(magnet)}`; 1597 | }; 1598 | insertionPoint.parentNode.insertBefore(button, insertionPoint); 1599 | }) 1600 | 1601 | } 1602 | function EhTagAria2Helper(){ 1603 | if(!(/gallerytorrents\.php/).test(unsafeWindow.location.href)){ 1604 | return; 1605 | } 1606 | 1607 | 1608 | let ariaOptions = JSON.parse(JSON.stringify(etbConfig.ariaOptions)); 1609 | ariaOptions.auth.type *= 1; 1610 | let aria = new Aria2(ariaOptions); 1611 | console.log('unsafeWindow.aria',unsafeWindow.aria); 1612 | 1613 | 1614 | console.log('EhTagAria2Helper'); 1615 | let tableList = document.querySelectorAll("#torrentinfo form table"); 1616 | if(tableList&&tableList.length)tableList.forEach(function (table) { 1617 | let href = ''; 1618 | let a = table.querySelector('a'); 1619 | if(a)href = a.href; 1620 | if(!href)return; 1621 | 1622 | let insertionPoint = table.querySelector('input'); 1623 | if(!insertionPoint)return; 1624 | 1625 | var button = document.createElement("input"); 1626 | button.type = "button"; 1627 | button.value = "Aria2下载"; 1628 | button.className = 'stdbtn'; 1629 | button.onclick = function () { 1630 | aria.addUri([href],function(){ 1631 | myNotification('添加成功',{ 1632 | body:href 1633 | }); 1634 | },function () { 1635 | myNotification('添加失败',{ 1636 | body:href 1637 | }); 1638 | }); 1639 | }; 1640 | insertionPoint.parentNode.insertBefore( button, insertionPoint ); 1641 | }) 1642 | 1643 | 1644 | 1645 | 1646 | 1647 | } 1648 | 1649 | //获取数据 1650 | async function startProgram($scope){ 1651 | console.log('startProgram'); 1652 | 1653 | //存放承诺 1654 | var pp = { 1655 | wikiVersion:getWikiVersion(), 1656 | rows:getRows(), 1657 | tags:[] 1658 | }; 1659 | 1660 | //获取 版本与row 1661 | var [wikiVersion,rows] = await Promise.all([pp.wikiVersion,pp.rows]); 1662 | 1663 | $scope.dataset = rows; 1664 | $scope.wikiVersion = wikiVersion; 1665 | $scope.$apply(); 1666 | 1667 | //构建获取tag任务 并执行 1668 | 1669 | rows.forEach(function (row) { 1670 | var temp = getTags(row.name); 1671 | temp.then(function (mdText) { 1672 | row.tags = parseTable(mdText,row.name); 1673 | $scope.$apply(); 1674 | }); 1675 | pp.tags.push(temp); 1676 | }); 1677 | 1678 | //等待获取完毕 1679 | await Promise.all(pp.tags); 1680 | console.log(rows); 1681 | 1682 | return rows; 1683 | } 1684 | 1685 | //构建css 1686 | function buildCSS(dataset,wikiVersion){ 1687 | console.time('生成css样式'); 1688 | var css = ""; 1689 | 1690 | css+=` 1691 | /* update_time:${wikiVersion.update_time} */ 1692 | /* hash:${wikiVersion.code} */ 1693 | `; 1694 | 1695 | dataset.forEach(function (row) { 1696 | css+= `\n/* ${row.name} ${row.cname} */\n`; 1697 | // console.log(row.tags); 1698 | row.tags.forEach(function (tag) { 1699 | if(tag.name){ 1700 | var tagid = (row.name=="misc"?"":row.name + ":") + tag.name.replace(/\s/ig,"_"); 1701 | var tagid2 = (row.name=="misc"?":":row.name + ":") + tag.name; 1702 | var cname = mdImg2cssImg(specialCharToCss(tag.cname),etbConfig.imageLimit<0?Infinity:etbConfig.imageLimit); 1703 | if(!tag.info)tag.info=""; 1704 | var content = mdImg2cssImg(htmlBr2cssBr(specialCharToCss(tag.info)),etbConfig.imageLimit<0?Infinity:etbConfig.imageLimit); 1705 | css += ` 1706 | a[id="ta_${tagid}"], .gt[title="${tagid2}"], .gtl[title="${tagid2}"]{ 1707 | font-size:0; 1708 | } 1709 | a[id="ta_${tagid}"]::before, .gt[title="${tagid2}"]:before, .gtl[title="${tagid2}"]:before{ 1710 | content:"${cname}"; 1711 | } 1712 | `; 1713 | //当没有内容时,封闭标签边框 1714 | if(!content)css+=` 1715 | a[id="ta_${tagid}"]:hover::before,a[id="ta_${tagid}"]:focus::before{ 1716 | border-width:1px !important; 1717 | border-radius:5px !important; 1718 | }`; 1719 | 1720 | if(content)css+=`a[id="ta_${tagid}"]::after{ 1721 | content:"${content}"; 1722 | }`; 1723 | }else{ 1724 | css += `\n/* ${row.cname} */\n`; 1725 | } 1726 | }); 1727 | }); 1728 | console.timeEnd('生成css样式'); 1729 | return css; 1730 | 1731 | } 1732 | 1733 | //Stylish css 1734 | function buildStylishCSS(css,config){ 1735 | var cssStylish = "@namespace url(http://www.w3.org/1999/xhtml);\n"; 1736 | 1737 | cssStylish+=`@-moz-document 1738 | domain('exhentai.org'), 1739 | domain('e-hentai.org') 1740 | { 1741 | /* 通用样式 */ 1742 | ${config.style.public} 1743 | } 1744 | `; 1745 | cssStylish+=`@-moz-document 1746 | domain('e-hentai.org') 1747 | { 1748 | /* 表站样式 */ 1749 | ${config.style.eh} 1750 | } 1751 | `; 1752 | cssStylish+=`@-moz-document 1753 | domain('exhentai.org') 1754 | { 1755 | /* 里站样式 */ 1756 | ${config.style.ex} 1757 | } 1758 | `; 1759 | 1760 | cssStylish+=`@-moz-document 1761 | domain('exhentai.org'), 1762 | domain('e-hentai.org') 1763 | { 1764 | body{ } 1765 | /* 翻译样式 */ 1766 | ${css} 1767 | }`; 1768 | return cssStylish; 1769 | } 1770 | 1771 | //转换换行 1772 | function htmlBr2cssBr(mdText){ 1773 | return mdText.replace(//igm,"\\A "); 1774 | } 1775 | 1776 | //转换图片 1777 | function mdImg2cssImg(mdText,max=Infinity){ 1778 | var n = 0; 1779 | return mdText.replace(/\!\[(.*?)\]\((.*?)\)/igm,function (text,alt,href,index) { 1780 | n++; 1781 | if( max >= n){ 1782 | var h = trim(href); 1783 | if(h.slice(0,1) == "#"){ 1784 | h = h.replace(/# +\\?['"](.*?)\\?['"]/igm,"$1"); 1785 | }else if(h.slice(h.length-1,h.length).toLowerCase() == 'h'){ 1786 | h = h.slice(0,-1); 1787 | } 1788 | return `"url("${h}")"`; 1789 | }else{ 1790 | return ""; 1791 | } 1792 | }); 1793 | } 1794 | 1795 | function specialCharToCss(str){ 1796 | var strn = str; 1797 | strn = strn.replace("\\","\\\\"); 1798 | strn = strn.replace("\"","\\\""); 1799 | strn = strn.replace("\r",""); 1800 | strn = strn.replace("\n","\\A "); 1801 | return strn; 1802 | } 1803 | 1804 | //获取版本 1805 | function getWikiVersion(){ 1806 | return new Promise(function (resolve, reject) { 1807 | 1808 | PromiseRequest.get(version_URL+'?t='+new Date().getTime()).then(function (response) { 1809 | var parser = new DOMParser(); 1810 | var PageDOM = parser.parseFromString(response, "text/html"); 1811 | var lastDOM = PageDOM.querySelector('#repo-content-pjax-container .TimelineItem'); 1812 | if(!lastDOM){ 1813 | reject(); 1814 | return; 1815 | } 1816 | var code = ""; 1817 | var time = 0; 1818 | var commit = ""; 1819 | 1820 | var timeDOM = lastDOM.querySelector("relative-time"); 1821 | if(timeDOM)time = Date.parse(timeDOM.getAttribute('datetime')); 1822 | 1823 | var codeDOM = lastDOM.querySelector("clipboard-copy"); 1824 | if(codeDOM)code = codeDOM.getAttribute('value'); 1825 | 1826 | var commitDOM = lastDOM.querySelector(".Link--primary"); 1827 | if(commitDOM)commit = commitDOM.textContent.trim(); 1828 | var v = { 1829 | update_time:time, 1830 | code:code, 1831 | commit:commit 1832 | }; 1833 | resolve(v); 1834 | },function () { 1835 | reject(); 1836 | }); 1837 | }); 1838 | } 1839 | 1840 | //去除两端空白 1841 | function trim(s){ 1842 | if(typeof s == 'string'){ 1843 | return s.replace(/(^\s*)|(\s*$)/g, ""); 1844 | }else{ 1845 | return s; 1846 | } 1847 | } 1848 | 1849 | function timeInterval (time){ 1850 | if(!time){ 1851 | return ''; 1852 | } 1853 | var now = (new Date).valueOf(); 1854 | now = Math.floor(now/1000); 1855 | time = Math.floor(time/1000); 1856 | var t = now-time; 1857 | 1858 | if(!t){ 1859 | return '刚刚'; 1860 | } 1861 | var f = [ 1862 | [31536000,'年'], 1863 | [2592000,'个月'], 1864 | [604800,'星期'], 1865 | [86400,'天'], 1866 | [3600,'小时'], 1867 | [60,'分钟'], 1868 | [1,'秒'] 1869 | ]; 1870 | var c = 0; 1871 | for(var i in f){ 1872 | var k = f[i][0]; 1873 | var v = f[i][1]; 1874 | c = Math.floor(t/k); 1875 | if (0 != c) { 1876 | return c+v+'前'; 1877 | } 1878 | } 1879 | } 1880 | 1881 | //获取行 并解析 1882 | function getRows(){ 1883 | return new Promise(async function (resolve, reject) { 1884 | var url = `${wiki_raw_URL}/${rows_filename}.md`+"?t="+new Date().getTime(); 1885 | console.log(url); 1886 | var data = await PromiseRequest.get(url); 1887 | /*剔除表格以外的内容*/ 1888 | var re = (/^\|.*\|$/gm); 1889 | var table = ""; 1890 | console.log("test",parseTable(data)); 1891 | resolve( parseTable(data) ); 1892 | }); 1893 | } 1894 | 1895 | //获取标签 并解析 1896 | function getTags(row) { 1897 | return new Promise(async function (resolve, reject) { 1898 | 1899 | var url = `${wiki_raw_URL}/${row}.md`+"?t="+new Date().getTime(); 1900 | console.log(url); 1901 | console.time(`加载 ${row}`); 1902 | var data = await PromiseRequest.get(url); 1903 | console.timeEnd(`加载 ${row}`); 1904 | resolve(data); 1905 | }); 1906 | } 1907 | 1908 | function parseTable(data,name){ 1909 | /*剔除表格以外的内容*/ 1910 | var re = (/^\s*(\|.*\|)\s*$/gm); 1911 | var table = ""; 1912 | var temp = ""; 1913 | while( temp = re.exec(data) ){ 1914 | if(table)table+="\n"; 1915 | table+=temp[1]; 1916 | } 1917 | table = table.replace(/\\\|/igm,"{~Line~}"); 1918 | let tableArr = table.split("\n").map( 1919 | (row)=>row.split("|").map( 1920 | (t)=>t.replace("{~Line~}","|") 1921 | ) 1922 | ); 1923 | let tags = []; 1924 | var count = []; 1925 | tableArr.forEach(function (tr,index) { 1926 | if(index>1){ 1927 | let t = {}; 1928 | tr[1] = trim(tr[1]||""); 1929 | tr[2] = trim(tr[2]||""); 1930 | tr[3] = trim(tr[3]||""); 1931 | tr[4] = trim(tr[4]||""); 1932 | if(tr[1])t.name = tr[1].replace(/\\~/g, '~'); 1933 | if(tr[2])t.cname = tr[2].replace(/\\~/g, '~'); 1934 | if(tr[3])t.info = tr[3].replace(/\\~/g, '~'); 1935 | if(tr[4])t.links = mdLinks(tr[4]); 1936 | tags.push(t); 1937 | if(t.name){count++}; 1938 | } 1939 | }); 1940 | console.log(name,count); 1941 | return tags; 1942 | } 1943 | function mdLinks(mdText) { 1944 | var links = []; 1945 | mdText.replace(/\[(.*?)\]\((.*?)\)/igm,function (text,alt,href,index) { 1946 | links.push({ 1947 | title:alt, 1948 | href:href, 1949 | }); 1950 | return text; 1951 | }); 1952 | return links 1953 | } 1954 | 1955 | function hrefTest(re){ 1956 | return re.test(unsafeWindow.location.href); 1957 | } 1958 | 1959 | 1960 | function tagsIndexes(tags) { 1961 | let map = {}; 1962 | console.time('构建索引'); 1963 | tags.forEach(function (v,row) { 1964 | map[v.name] = { 1965 | index:row, 1966 | tags:{} 1967 | }; 1968 | v.tags.forEach(function (tag,index) { 1969 | map[v.name].tags[tag.name] = index; 1970 | }) 1971 | }); 1972 | console.timeEnd('构建索引'); 1973 | return map; 1974 | } 1975 | 1976 | async function autoUpdate() { 1977 | var $scope = {}; 1978 | $scope.$apply = function(){}; 1979 | await startProgram($scope); 1980 | var css = buildCSS($scope.dataset,$scope.wikiVersion); 1981 | GM_setValue('tags',{ 1982 | css:css, 1983 | data:$scope.dataset, 1984 | map:tagsIndexes($scope.dataset), 1985 | version:$scope.wikiVersion, 1986 | update_time:new Date().getTime() 1987 | }); 1988 | return true; 1989 | } 1990 | 1991 | async function myNotification(title,options) 1992 | { 1993 | let permission = await Notification.requestPermission(); 1994 | if(permission == 'granted'){ 1995 | return new Notification(title, options); 1996 | }else{ 1997 | return false; 1998 | } 1999 | } 2000 | 2001 | //承诺封装的异步请求 2002 | function PromiseRequest(option) { 2003 | return new Promise(function (resolve, reject) { 2004 | option.onload = function (response) { 2005 | resolve(response.responseText); 2006 | }; 2007 | option.onerror = function (response) { 2008 | reject(response); 2009 | }; 2010 | // if(rootScope && rootScope.$broadcast){ 2011 | // 2012 | // } 2013 | // option.onprogress = function (response,response2) { 2014 | // // var info = { 2015 | // // loaded:response.loaded, 2016 | // // position:response.position, 2017 | // // total:response.total, 2018 | // // totalSize:response.totalSize, 2019 | // // }; 2020 | // // console.info('onprogress',info,response,response2); 2021 | // }; 2022 | GM_xmlhttpRequest(option); 2023 | }); 2024 | } 2025 | //助手 快速get post 2026 | PromiseRequest.get = function (url) { 2027 | return PromiseRequest({ 2028 | method: "GET", 2029 | url: url, 2030 | }); 2031 | }; 2032 | PromiseRequest.post = function (url,data) { 2033 | var post = ""; 2034 | for(var i in data){ 2035 | if(post)post+="&"; 2036 | post+= encodeURIComponent(i)+"="+encodeURIComponent(data[i]); 2037 | } 2038 | return PromiseRequest({ 2039 | method: "POST", 2040 | url: url, 2041 | data: post 2042 | }); 2043 | }; 2044 | 2045 | var bootstrapInited = false; 2046 | var bootstrap = function(){ 2047 | if(bootstrapInited)return; 2048 | bootstrapInited = true; 2049 | //在github页面下添加生成工具 2050 | if((/github\.com/).test(unsafeWindow.location.href)){ 2051 | EhTagBuilder(); 2052 | } 2053 | 2054 | //在EH站点下添加版本提示功能 2055 | if ((/(exhentai\.org|e-hentai\.org)/).test(unsafeWindow.location.href)) { 2056 | if(etbConfig.syringe)EhTagVersion(); 2057 | if(etbConfig.syringe && (/(exhentai\.org\/g\/|e-hentai\.org\/g\/)/).test(unsafeWindow.location.href)){ 2058 | EhTagSyringeLink(); 2059 | } 2060 | if(etbConfig.searchHelper)EhTagInputHelper(); 2061 | if(etbConfig.download2miwifi)EhTagMiWifi(); 2062 | // EhTagMiWifi(); 2063 | if(etbConfig.ariaHelper)EhTagAria2Helper(); 2064 | if(etbConfig.magnetHelper)EhTagMagnetHelper(); 2065 | if(etbConfig.UITranslate)EhTagUITranslator(); 2066 | } 2067 | }; 2068 | 2069 | if (/loaded|complete/.test(document.readyState)){ 2070 | bootstrap(); 2071 | }else{ 2072 | document.addEventListener('DOMContentLoaded',bootstrap,false); 2073 | } 2074 | // domLoaded.then(function () { 2075 | // bootstrap(); 2076 | // }); 2077 | 2078 | //注射器总开关 2079 | if(etbConfig.syringe){ 2080 | //注入css 不需要等待页面 2081 | if((/(exhentai\.org\/|e-hentai\.org\/)/).test(unsafeWindow.location.href)){ 2082 | EhTagSyringe(); 2083 | } 2084 | } 2085 | 2086 | //UI翻译用的样式 2087 | if(etbConfig.UITranslate){ 2088 | if(hrefTest(/(exhentai\.org|e-hentai\.org)/)){ 2089 | AddGlobalStyle(uiTranslateStyle) 2090 | } 2091 | } 2092 | 2093 | 2094 | })(); 2095 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 已迁移 2 | 该项目及翻译数据库已迁移到 GitHub 组织 [EhTagTranslation](https://github.com/EhTagTranslation)。本项目及 Wiki 即日起停止更新。 3 | 4 | 需要安装新的翻译工具,请移步 [EhTagTranslation/EhSyringe](https://github.com/EhTagTranslation/EhSyringe);想要提供或使用新的翻译,请移步 [EhTagTranslation/Database](https://github.com/EhTagTranslation/Database)。 5 | 6 | # EhTagTranslator 7 | 将E绅士tag翻译成中文。 8 | ![FBI WARNING](https://raw.githubusercontent.com/wiki/Mapaler/EhTagTranslator/project-document/images/FBI%20WARNING.png) 9 | **This is a project for adult website, and the content of this item may include "sexual expression" and "restricted images" show.View at your own risk.** 10 | 11 | ![预览图](https://raw.githubusercontent.com/wiki/Mapaler/EhTagTranslator/project-document/images/preview.png) 12 | 13 | ## 使用方法 14 | 15 | 已经迫不及待要来一发了吗?请查看▶ [使用文档](https://github.com/Mapaler/EhTagTranslator/wiki/使用文档) ◀ 16 | 17 | 希望您在享受他人成果的同时,在本项目Wiki中添加翻译,贡献你的一份力量。 18 | 19 | ## 参与翻译 20 | EhTagTranslator是一个免费开源项目,Tag翻译数据库由各位网友自行编辑。 21 | 22 | 请访问页面上方的[Wiki](https://github.com/Mapaler/EhTagTranslator/wiki) 23 | 24 | ![Wiki地址](https://raw.githubusercontent.com/wiki/Mapaler/EhTagTranslator/wiki-document/images/where%20is%20wiki.png) 25 | 26 | ## License|许可协议 27 | ### EhTagTranslator官方程序 28 | 本项目程序代码除另有声明外,均在[GNU通用公共许可证第三版(GPLv3)](https://github.com/Mapaler/EhTagTranslator/blob/master/LICENSE)下提供。 29 | 30 | ### EhTagTranslator-Wiki数据库 31 | Wiki文本内容除另有声明外,均在[知识共享(Creative Commons) 署名-非商业性使用-相同方式共享 3.0 协议](https://creativecommons.org/licenses/by-nc-sa/3.0/cn/legalcode)下提供,附加条款亦可能应用。 32 | -------------------------------------------------------------------------------- /template/ets-builder-menu.html: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 41 | 42 | 43 | 120 | 121 | 259 | 260 | 312 | 313 | 314 | 315 | 346 | 347 | 348 | 349 | 350 | 367 | -------------------------------------------------------------------------------- /template/ets-prompt.html: -------------------------------------------------------------------------------- 1 | 80 | 81 | 82 | 83 | {{pluginName}} 84 | NEW 85 | 86 | 87 |
88 | 89 |
90 | 91 |
92 | 93 |
94 |
已是最新版本
95 |
96 | 有更新! 发布于{{timetime(newVersion.update_time)}} 97 |
98 |
99 | {{wikiVersion.code}}...{{newVersion.code}} 100 |
101 |
上次检查:{{timetime(lastVersionCheck.time)}}
102 |
上次更新:{{timetime(update_time)}}
103 | 104 |
105 |
未获取到版本信息
106 |
107 | 没有翻译数据,请先获取数据 108 |
109 | 更新数据 110 |
111 |
112 | 113 | 118 | 119 |
120 |
121 | -------------------------------------------------------------------------------- /template/ui-translate.css: -------------------------------------------------------------------------------- 1 | .itdc a, 2 | #gdc a, 3 | #searchbox .itc tr td{ 4 | position: relative; 5 | } 6 | .itdc a img, 7 | #gdc a img, 8 | #searchbox .itc tr td img{ 9 | opacity: 0; 10 | position: absolute; 11 | left: 50%; 12 | margin-left: -50px; 13 | top: 0; 14 | z-index: 1; 15 | } 16 | .itdc a::after, 17 | #gdc a::after, 18 | #searchbox .itc tr td::after{ 19 | content: ""; 20 | text-transform : uppercase; 21 | display: block; 22 | margin: 0 auto; 23 | width: 100px; 24 | height: 20px; 25 | border-radius: 10px; 26 | box-sizing: border-box; 27 | background: #fff; 28 | color: #333; 29 | line-height:20px; 30 | font-weight: bold; 31 | text-align: center; 32 | border: 1px solid #4f535b; 33 | text-decoration:none; 34 | } 35 | #searchbox .itc tr td.icon_disable::after{ 36 | opacity: 0.5; 37 | } 38 | 39 | .icon_doujinshi, 40 | #gdc a[href$="hentai.org/doujinshi"]::after, 41 | .itdc a[href$="hentai.org/doujinshi"]::after, 42 | #searchbox .itc tr:nth-child(1) td:nth-child(1)::after{ 43 | content: "同人本"; 44 | border: 1px solid rgba(255, 054, 054,1); 45 | box-shadow: 46 | 0px 1px 1px 1px rgba(255, 054, 054,0.3) inset, 47 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 48 | 0px 7px 8px 0px rgba(255, 054, 054,0.7) inset, 49 | 0px -3px 5px 0px rgba(255, 054, 054,1.0) inset; 50 | } 51 | 52 | .icon_manga, 53 | #gdc a[href$="hentai.org/manga"]::after, 54 | .itdc a[href$="hentai.org/manga"]::after, 55 | #searchbox .itc tr:nth-child(1) td:nth-child(2)::after{ 56 | content: "漫画"; 57 | border: 1px solid rgba(255, 183, 053,1); 58 | box-shadow: 59 | 0px 1px 1px 1px rgba(255, 183, 053,0.3) inset, 60 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 61 | 0px 7px 8px 0px rgba(255, 183, 053,0.7) inset, 62 | 0px -3px 5px 0px rgba(255, 183, 053,1.0) inset; 63 | } 64 | 65 | .icon_artistcg, 66 | #gdc a[href$="hentai.org/artistcg"]::after, 67 | .itdc a[href$="hentai.org/artistcg"]::after, 68 | #searchbox .itc tr:nth-child(1) td:nth-child(3)::after{ 69 | content: "画师CG"; 70 | border: 1px solid rgba(234, 219, 053,1); 71 | box-shadow: 72 | 0px 1px 1px 1px rgba(234, 219, 053,0.3) inset, 73 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 74 | 0px 7px 8px 0px rgba(234, 219, 053,0.7) inset, 75 | 0px -3px 5px 0px rgba(234, 219, 053,1.0) inset; 76 | } 77 | 78 | .icon_gamecg, 79 | #gdc a[href$="hentai.org/gamecg"]::after, 80 | .itdc a[href$="hentai.org/gamecg"]::after, 81 | #searchbox .itc tr:nth-child(1) td:nth-child(4)::after{ 82 | content: "游戏cg"; 83 | border: 1px solid rgba(055, 155, 054,1); 84 | box-shadow: 85 | 0px 1px 1px 1px rgba(055, 155, 054,0.3) inset, 86 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 87 | 0px 7px 8px 0px rgba(055, 155, 054,0.7) inset, 88 | 0px -3px 5px 0px rgba(055, 155, 054,1.0) inset; 89 | } 90 | 91 | .icon_western, 92 | #gdc a[href$="hentai.org/western"]::after, 93 | .itdc a[href$="hentai.org/western"]::after, 94 | #searchbox .itc tr:nth-child(1) td:nth-child(5)::after{ 95 | content: "西方"; 96 | border: 1px solid rgba(163, 250, 071,1); 97 | box-shadow: 98 | 0px 1px 1px 1px rgba(163, 250, 071,0.3) inset, 99 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 100 | 0px 7px 8px 0px rgba(163, 250, 071,0.7) inset, 101 | 0px -3px 5px 0px rgba(163, 250, 071,1.0) inset; 102 | } 103 | 104 | 105 | 106 | .icon_non-h, 107 | #gdc a[href$="hentai.org/non-h"]::after, 108 | .itdc a[href$="hentai.org/non-h"]::after, 109 | #searchbox .itc tr:nth-child(2) td:nth-child(1)::after{ 110 | content: "非H"; 111 | border: 1px solid rgba(073, 179, 255,1); 112 | box-shadow: 113 | 0px 1px 1px 1px rgba(073, 179, 255,0.3) inset, 114 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 115 | 0px 7px 8px 0px rgba(073, 179, 255,0.7) inset, 116 | 0px -3px 5px 0px rgba(073, 179, 255,1.0) inset; 117 | } 118 | 119 | .icon_imageset, 120 | #gdc a[href$="hentai.org/imageset"]::after, 121 | .itdc a[href$="hentai.org/imageset"]::after, 122 | #searchbox .itc tr:nth-child(2) td:nth-child(2)::after{ 123 | content: "图集"; 124 | border: 1px solid rgba(052, 055, 255,1); 125 | box-shadow: 126 | 0px 1px 1px 1px rgba(052, 055, 255,0.3) inset, 127 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 128 | 0px 7px 8px 0px rgba(052, 055, 255,0.7) inset, 129 | 0px -3px 5px 0px rgba(052, 055, 255,1.0) inset; 130 | } 131 | 132 | 133 | .icon_cosplay, 134 | #gdc a[href$="hentai.org/cosplay"]::after, 135 | .itdc a[href$="hentai.org/cosplay"]::after, 136 | #searchbox .itc tr:nth-child(2) td:nth-child(3)::after{ 137 | content: "cosplay"; 138 | border: 1px solid rgba(112, 054, 156,1); 139 | box-shadow: 140 | 0px 1px 1px 1px rgba(112, 054, 156,0.3) inset, 141 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 142 | 0px 7px 8px 0px rgba(112, 054, 156,0.7) inset, 143 | 0px -3px 5px 0px rgba(112, 054, 156,1.0) inset; 144 | } 145 | 146 | .icon_asianporn, 147 | #gdc a[href$="hentai.org/asianporn"]::after, 148 | .itdc a[href$="hentai.org/asianporn"]::after, 149 | #searchbox .itc tr:nth-child(2) td:nth-child(4)::after{ 150 | content: "亚洲"; 151 | border: 1px solid rgba(243, 174, 243,1); 152 | box-shadow: 153 | 0px 1px 1px 1px rgba(243, 174, 243,0.3) inset, 154 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 155 | 0px 7px 8px 0px rgba(243, 174, 243,0.7) inset, 156 | 0px -3px 5px 0px rgba(243, 174, 243,1.0) inset; 157 | } 158 | 159 | .icon_misc, 160 | #gdc a[href$="hentai.org/misc"]::after, 161 | .itdc a[href$="hentai.org/misc"]::after, 162 | #searchbox .itc tr:nth-child(2) td:nth-child(5)::after{ 163 | content: "杂项"; 164 | border: 1px solid rgba(214, 214, 214,1); 165 | box-shadow: 166 | 0px 1px 1px 1px rgba(214, 214, 214,0.3) inset, 167 | 0px 3px 3px 1px rgba(255, 255, 255,1.0) inset, 168 | 0px 7px 8px 0px rgba(214, 214, 214,0.7) inset, 169 | 0px -3px 5px 0px rgba(214, 214, 214,1.0) inset; 170 | } 171 | 172 | 173 | /* 174 | #FF3636 rgba(255, 054, 054, 1) doujinshi 175 | #FFB735 rgba(255, 183, 053, 1) manga 176 | #EADB35 rgba(234, 219, 053, 1) artist cg 177 | #379B36 rgba(055, 155, 054, 1) game cg 178 | #A3FA47 rgba(163, 250, 071, 1) western 179 | #49B3FF rgba(073, 179, 255, 1) non-h 180 | #3437FF rgba(052, 055, 255, 1) image set 181 | #70369C rgba(112, 054, 156, 1) cosplay 182 | #F3AEF3 rgba(243, 174, 243, 1) asian porn 183 | #D6D6D6 rgba(214, 214, 214, 1) misc 184 | 185 | */ --------------------------------------------------------------------------------