Loading. Please Wait... 
 |
 |
 |
[Script] Search bar with tags and autocomplete |
|
Oct 25 2020, 16:11
|
ciccabanana
Lurker
Group: Recruits
Posts: 8
Joined: 7-September 17

|
The script replace the normal search bar with new one whit autocomplete of tags. I often use the search bar and write the complete definition of the tag each time is boring. To make faster and easier I made a script that allows me search the tag through the site api. Here is the script: [ github.com] https://github.com/ciccabanana/e-hentai-hel...-helper.user.jsThere is some documentation: [ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/For any issue: [ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/issuesPreview gif: (IMG:[ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/raw/master/images/tag-helper.webp) Features- Compatible with Tampermonkey, Greasemonkey and Violentmonkey
- Autocomplete of tags using site API
- Delayed API request during typing and caching for avoid server restriction
- Possibility of save favorites tags as bookmarks
- Support the Exclusion `-` and the OR `~` operator See the ehwiki
Supprot all qualifiers (tag, weak, title, uploader, uploaduid, gid, comment, favnote) (see below ↓ #Qualifiers) - Fast autocomplete using category index (ignore case) (see below #Namespaces)
- Colored tags by qualifier or namespace (Color inspired by website colors of class i.e. color of class Doujinshi is used for female tags ecc...)
- Settings interface (see below ↓ #settings-ui-preview)
- Keyboard and mouse shortcut
- Fast loading, the script will load alongside the website
- No duplicate allowed.
- Works both in front page and favorites search bar.
- Works on both e-hentai and sadpanda.
CacheThis feature allows the program to save user's inputs and corresponding server responses by creating a cache. If the user re-enters the same input, the response is delivered more quickly from the cache, without needing to query the API again. Users have the option to clear all cached data at any time or to remove only the data that is older than a specified number of days, with the ability to choose the number of days themselves. (IMG:[ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/raw/master/images/tag-helper-settings-cache.png) BookmarksThis feature allows users to save their favorite tags and access them quickly from a dropdown menu that appears beneath the search bar when it gains focus. Users can easily add or remove favorites either through the settings or directly while searching for a tag by clicking on the bookmark icon or using the Ctrl+B keyboard shortcut. Favorites can be saved with full details, including Namespace, Qualifiers, Exclusion operators (-), and OR operators (~). The feature supports a maximum of 50 favorite tags, with the top 25 being displayed in the dropdown menu for quick access. Users can also reorder their favorites through the settings using a simple drag-and-drop interface. (IMG:[ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/raw/master/images/tag-helper-settings-bookmarks.webp) Namespaces: (For more info See the ehwiki) - a: => artist
- c: => character
- co: => cosplayer
- f: => female
- g: => group
- l: => language
- m: => male
- x: OR mix: => mixed
- o: other
- p: => parody
- r: => reclass
- mis: => temp
Qualifiers: (For more info See the ehwiki) ⚠️ N.B. Only the qualifier " tag" and " weak" have the autocomplete feature. - tg: => tag
- wk: => weak
- tt: OR ti: => title
- up: => uploader
- upd: => uploaduid
- gd: => gid
- m: => comment
- fv: OR fav: => favnote
Settings:(IMG:[ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/raw/master/images/tag-helper-settings.png) Shortcut:- Dropdown
- ↑ ↓ - Navigate the list
- Ctrl+B - Add/Remove bookmarks
- Tag
- Middle click on a tag will remove the tag
- Left click will rotate between operator. Normal → Exclusion (-) → OR (~) → Normal
FQA:- Q: Why a not an hardcoded cache or favorites?
- A: Because if a user edit the code, for insert his favorites, the next update of the script will probably overwrite the changes done from the user. (It depends on with userscript managers the user use)
ToDoSettings interface DonePossibility of user to personalize tags color DoneSupport for Qualifiers "tag:" / "weak:" / "title:" / "uploader:" / "uploaduid:" / "gid:" / "comment:" / "favnote:" Done- The possibility of change the keyboard shortcut
- An option for enable an automatic clear of expired data in the cache (If users request this feature)
- Compatibility to work in the insertion of new tags on the gallery page (Under evaluation)
Known bugsThanks to- [github.com] yairEO For making Tagify, foundation on which I built this userscript
- [github.com] SortableJS For making the script that allow to reorder the bookmarks
This post has been edited by ciccabanana: Aug 18 2024, 17:24
|
|
|
|
 |
|
|
 |
|
Oct 26 2020, 13:55
|
ciccabanana
Lurker
Group: Recruits
Posts: 8
Joined: 7-September 17

|
QUOTE(Rikis @ Oct 26 2020, 09:40)  Wrong link.
Thanks dude, I've copied and pasted 2 time the same link xD QUOTE(Rikis @ Oct 26 2020, 09:40)  Sorry dude, but the script you linked over there looks like a copy and paste of the script used in the page Mytags. i.e. https://e-hentai.org/z/0348/ehg_mytags.c.jsIf the problem is a slow reaction of my script during typing, I can try to reduce the delay between typing and api requests. (Stop typing) -> ( Wait some time to see if the user has really ended typing) -> (Make api request) I have inserted this delay to prevent too much request during typing. Without this delay my script as yours (Yes, I tested it) will make at least 2 requests even if you type quickly. That is why I preferred to avoid it, adding a delay. If the problem is the loading time inside the website I can try to optimize it. If you want to be more meticulous you can to enable the debug mode of my script, changing to true [ github.com] line:26 ('var debug = false;' => 'var debug = true;') and tell me the loading time of the script on your PC. Please update to latest version (0.1.3) to get the message as in the example below. Example: [Tags Auto]: Loading time: 33.486083984375 ms For any issue or feature request please, reply to this post or better go and open an issue on GitHub: [ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/issues
|
|
|
|
 |
|
Oct 26 2020, 14:27
|
Rikis
Group: Gold Star Club
Posts: 3,680
Joined: 7-July 09

|
Yeah it's copy paste. Dropdown opening and closing doesn't help. Doesn't look smooth like mytags one.
|
|
|
Oct 26 2020, 22:04
|
ciccabanana
Lurker
Group: Recruits
Posts: 8
Joined: 7-September 17

|
QUOTE(Rikis @ Oct 26 2020, 13:27)  Yeah it's copy paste. Dropdown opening and closing doesn't help. Doesn't look smooth like mytags one.
Ok now I have understand what is the problem. The problem was if the dropdown was already show and was type another letter, the dropdown menu disappeared and was completely reloaded. I fixed this bug in the latest version, please check if smooth as you would like.
|
|
|
Oct 26 2020, 22:45
|
Rikis
Group: Gold Star Club
Posts: 3,680
Joined: 7-July 09

|
|
|
|
Oct 26 2020, 23:42
|
uareader
Group: Catgirl Camarilla
Posts: 5,592
Joined: 1-September 14

|
I'm not sure how this work, so maybe my proposal don't make sense, but it could be good if the system had both a softcoded and hardcoded cache system for autocompletion.
The softcoded cache would record what text you had typed before choosing something for the list, and the corresponding choice in the dropdown, so it can reload it faster during that browser session.
The hardcoded cache would be a list directly typed in the script code by the user, allowing him to put his favorites tags so that it's quickly available permanently and on every session, since it's hardcoded.
|
|
|
|
 |
|
Aug 2 2021, 22:08
|
diyer
Newcomer
  Group: Members
Posts: 51
Joined: 15-January 14

|
thank your script. (IMG:[ invalid] style_emoticons/default/smile.gif) would it add a new feature and work for vote tag? i think it may be cooler. (IMG:[ invalid] style_emoticons/default/tongue.gif) i changed a bit(only id) below, script of Rikis. --------- PENGUIN EDIT: for reasons CODE // ==UserScript== // @name EH Gallery AutoComplete // @namespace E-Hentai // @version 0.2 // @encoding utf-8 // @description autocomple for tags // @author Rikis // @match https://e-hentai.org/g/* // @match https://e-hentai.org/g/* // @connect self // @connect e-hentai.org // @connect * // @grant none // ==/UserScript==
if (typeof tagcompleter !== 'undefined') return;
(()=>{
let style = document.createElement('style'); style.innerHTML = '.tagcomplete{position:relative;display:inline-block}.tagcomplete-items{position:absolute;border:1px solid '+ '#B5A4A4;border-top:none;border-bottom:none;z-index:99;margin-left:60px;width:323px}.tagcomplete-items div{padding:10px;'+ 'cursor:pointer;background-color:#EDEBDF;text-align:left}.tagcomplete-items div:not(:last-child){border-bottom:1px solid '+ '#D4D4D4}.tagcomplete-items div:last-child{border-bottom:1px solid #B5A4A4}.tagcomplete-items div:hover{'+ 'background-color:#F3F0E0}.tagcomplete-active{background-color:#5C0D12!important;color:#EDEBDF};'; document.head.appendChild(style);
const api_url = "https://api.e-hentai.org/api.php";
function api_call(b, a, c) { b.open("POST", api_url); b.setRequestHeader("Content-Type", "application/json"); b.withCredentials = true; b.onreadystatechange = c; b.send(JSON.stringify(a)); } function api_response(b) { if (b.readyState == 4) { if (b.status == 200) { var a = JSON.parse(b.responseText); if (a.login != undefined) { top.location.href = 'https://e-hentai.org/home.php'; } else { return a; } } else { console.error("Server communication failed: " + b.status + " (" + b.responseText + ")"); } } return false; }
var tagcomplete_focus = -1; function tagcompleter(j) { let l = undefined; let g = undefined, f = undefined; let e = undefined; function d(m) { if (e === m) { return; } e = m; if (g != undefined) { if (f != undefined) { return; } else { clearTimeout(g); g = undefined; } } setTimeout(function () { f = new XMLHttpRequest(); let n = { method: "tagsuggest", text: m }; api_call(f, n, h); }, 200); } function h() { var m = api_response(f); if (m != false) { if (m.error != undefined) { console.error(m.error); } else { if (tagcomplete_focus < 0) { a(); l = m.tags; } } f = undefined; k(); } } function k() { a(); var n = j.value.replace(/["\']/g, ""); if (n.match(/^(x|mi).*:/)) { n = n.replace(/^(x|mi).*:/, "misc:"); } else { n = n .replace(/^f.*:/, "female:") .replace(/^m.*:/, "male:") .replace(/^r.*:/, "reclass:") .replace(/^l.*:/, "language:") .replace(/^p.*:/, "parody:") .replace(/^c.*:/, "character:") .replace(/^g.*:/, "group:") .replace(/^a.*:/, "artist:"); } if (n.replace(/^.*:/, "").length < 2) { return false; } else { d(n); } if (l == undefined) { return false; } tagcomplete_focus = -1; var t = document.createElement("DIV"); t.setAttribute("id", j.id + "tagcomplete-list"); t.setAttribute("class", "tagcomplete-items"); j.parentNode.appendChild(t); var o = 0; var p = new RegExp("(^| |:)" + n, "ig"); for (var tagid in l) { var q = l[tagid].ns + ':' + l[tagid].tn + ''; var m = l[tagid].ns + ':"' + l[tagid].tn + '$"'; if (q.match(p)) { var u = l[tagid].mid != undefined ? l[tagid].mns + ":" + l[tagid].mtn : undefined; var r = u == undefined ? q : q + " <strong>=></strong> " + u; // var m = u == undefined ? q : u; var s = document.createElement("DIV"); s.innerHTML = r.replace(p, "<strong>$&</strong>"); s.setAttribute("data-value", m); s.addEventListener("click", function (v) { j.value = this.getAttribute("data-value"); a(); var elem=document.getElementById("newtagfield"); elem.focus(); }); t.appendChild(s); ++o; } } if (o > 0) { j.style.borderRadius = "3px 3px 0 0"; } } j.addEventListener("input", function (m) { k(); }); j.addEventListener("keydown", function (n) { if (l == undefined) { return; } var m = document.getElementById(this.id + "tagcomplete-list"); if (m) { m = m.getElementsByTagName("div"); } if (n.keyCode == 40) { ++tagcomplete_focus; b(m); } else { if (n.keyCode == 38) { --tagcomplete_focus; b(m); } else { if (n.keyCode == 13) { // n.preventDefault(); if (m && tagcomplete_focus > -1) { m[tagcomplete_focus].click(); } } } } }); function b(m) { if (!m) { return false; } c(m); if (tagcomplete_focus >= m.length) { tagcomplete_focus = 0; } if (tagcomplete_focus < 0) { tagcomplete_focus = m.length - 1; } m[tagcomplete_focus].classList.add("tagcomplete-active"); } function c(m) { for (var n = 0; n < m.length; n++) { m[n].classList.remove("tagcomplete-active"); } } function a(o) { j.style.borderRadius = ""; var m = document.getElementsByClassName("tagcomplete-items"); for (var n = 0; n < m.length; n++) { if (o != m[n] && o != j) { m[n].parentNode.removeChild(m[n]); } } } document.addEventListener("click", function (m) { a(m.target); }); }
var elem=document.getElementById("newtagfield"); elem.autocomplete = "off" tagcompleter(elem)
})();
This post has been edited by blue penguin: Aug 2 2021, 23:02
|
|
|
|
 |
|
Aug 2 2021, 23:04
|
blue penguin
Group: Gold Star Club
Posts: 10,046
Joined: 24-March 12

|
Apart from a few edits I needed to make, don't use @icon if you value the users of the script.
I do not like the idea of someone who owns an s2 bucket getting my EH browsing history.
|
|
|
Aug 2 2021, 23:26
|
diyer
Newcomer
  Group: Members
Posts: 51
Joined: 15-January 14

|
QUOTE(blue penguin @ Aug 2 2021, 23:04)  Apart from a few edits I needed to make, don't use @icon if you value the users of the script.
I do not like the idea of someone who owns an s2 bucket getting my EH browsing history.
I didn't consider that aspect, sorry. (IMG:[ invalid] style_emoticons/default/anime_cry.gif)
|
|
|
Nov 22 2022, 21:21
|
Jerrk
Newcomer
 Group: Members
Posts: 47
Joined: 8-July 12

|
Any chance for an update for the new search system?
|
|
|
|
 |
|
Nov 25 2022, 16:38
|
babydragon0123
Newcomer
  Group: Gold Star Club
Posts: 55
Joined: 11-November 11

|
QUOTE(ciccabanana @ Oct 25 2020, 21:11)  The script replace the normal search bar with new one whit autocomplete of tags. I often use the search bar and write the complete definition of the tag each time is boring. To make faster and easier I made a script that allows me search the tag through the site api. E.g. If i want to search the english gallerys i will simply tap "eng" and select "language:english" from the dropdown. P.s. I tried to make as few API requests as possible during typing using varius delay, at least one request is made. Here is the script: [ github.com] https://github.com/ciccabanana/e-hentai-hel...-helper.user.jsThere is some documentation: [ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/For any issue: [ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/issuesPreview gif: (IMG:[ github.com] https://github.com/ciccabanana/e-hentai-helper-suite/raw/master/images/tag-helper.gif) Features- Compatible with Tampermonkey, Greasemonkey and Violentmonkey
- Fast loading ~40ms
- Autocomplete of tags using site API
- Delayed API request during typing for avoid server overload
- Fast autocomplete using category index (ignore case) (see below #Category-index)
- Colored tags by category (Color inspired by website colors of class i.e. color of class Doujinshi is used for female tags ecc...)
- No duplicate allowed.
- Works both in front page and favorites search bar.
- Works on both e-hentai and sadpanda.
Category index- f: => female
- m: => male
- l: => language
- p: => parody
- c: => character
- g: => group
- a: => artist
- x: OR mi: => misc
ToDo- Settings interface
- Possibility of user to personalize tags color
- Compatibility to work in the insertion of new tags on the gallery page (Under evaluation)
Known bugsThank you very much for your script. Can you update it to make it work with current site?
|
|
|
|
 |
|
Jan 9 2023, 11:41
|
defski
Newcomer
 Group: Members
Posts: 39
Joined: 10-January 19

|
Ditto, an update would be appreciated. I don't know what admin changed, but a bunch of my scripts stopped working.
|
|
|
Jan 9 2023, 12:10
|
Mayriad
Group: Global Mods
Posts: 2,061
Joined: 18-December 10

|
QUOTE(defski @ Jan 9 2023, 09:41)  Ditto, an update would be appreciated. I don't know what admin changed, but a bunch of my scripts stopped working.
The search engine was upgraded and a lot of things changed, so it is natural that many scripts will stop working without a code update. You can read about the search engine upgrade here: https://forums.e-hentai.org/index.php?showtopic=261743
|
|
|
|
 |
|
Nov 20 2023, 16:03
|
ciccabanana
Lurker
Group: Recruits
Posts: 8
Joined: 7-September 17

|
QUOTE(defski @ Jan 9 2023, 10:41)  Ditto, an update would be appreciated. I don't know what admin changed, but a bunch of my scripts stopped working.
QUOTE(Mayriad @ Jan 9 2023, 11:10)  The search engine was upgraded and a lot of things changed, so it is natural that many scripts will stop working without a code update. You can read about the search engine upgrade here: https://forums.e-hentai.org/index.php?showtopic=261743Sorry for the delay, I had some personal business to do. Soon I will update the script. I found some bug with the new code and I will to fix it before the release.
|
|
|
Dec 1 2023, 03:28
|
ciccabanana
Lurker
Group: Recruits
Posts: 8
Joined: 7-September 17

|
As I announced, here is a brand new version. I hope you enjoy.
|
|
|
Aug 18 2024, 17:28
|
ciccabanana
Lurker
Group: Recruits
Posts: 8
Joined: 7-September 17

|
I released a new update with bookmarks (favorite) and a caching system.
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
|
 |
 |
 |
|
|
|