-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSearch Fakku Doujin with Schale Network Mirrors.user.js
90 lines (74 loc) · 3.84 KB
/
Search Fakku Doujin with Schale Network Mirrors.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// ==UserScript==
// @name Search Fakku Doujin with Schale Network Mirrors
// @namespace http://tampermonkey.net/
// @version 1.05.3
// @description Extracts title and searches on Schale Network mirrors (NiyaNiya, Seia, Shupogaki, Hoshino). Marks Koharu and Seia as inactive in red color.
// @author FunkyJustin
// @match https://www.fakku.net/hentai/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Function to create and insert search buttons
function addSearchButtons() {
const titleElement = document.querySelector('h1[class^="block col-span-full"]');
if (titleElement) {
const title = titleElement.innerText;
// Create a container for all buttons
const buttonContainer = document.createElement('div');
buttonContainer.style.display = 'flex';
buttonContainer.style.flexDirection = 'column'; // Stack rows vertically
buttonContainer.style.alignItems = 'flex-start'; // Align to the left
buttonContainer.style.gap = '10px'; // Add spacing between rows
buttonContainer.style.marginTop = '20px';
// Row for active (green) buttons
const activeRow = document.createElement('div');
activeRow.style.display = 'flex';
activeRow.style.gap = '10px'; // Add spacing between buttons
// Row for inactive (red) buttons
const inactiveRow = document.createElement('div');
inactiveRow.style.display = 'flex';
inactiveRow.style.gap = '10px'; // Add spacing between buttons
// Add buttons for all mirrors
const niyaNiyaButton = createButton('Search with NiyaNiya', title, 'https://niyaniya.moe/?s=');
const shupogakiButton = createButton('Search with Shupogaki', title, 'https://shupogaki.moe/?s=');
const hoshinoButton = createButton('Search with Hoshino', title, 'https://hoshino.one/?s=');
const koharuButton = createButton('Search with Koharu (Inactive)', title, 'https://koharu.to/?s=', '#FF0000');
const seiaButton = createButton('Search with Seia (Inactive)', title, 'https://seia.to/?s=', '#FF0000');
// Append buttons to respective rows
activeRow.appendChild(niyaNiyaButton);
activeRow.appendChild(shupogakiButton);
activeRow.appendChild(hoshinoButton);
inactiveRow.appendChild(koharuButton);
inactiveRow.appendChild(seiaButton);
// Append rows to the container
buttonContainer.appendChild(activeRow);
buttonContainer.appendChild(inactiveRow);
// Insert the button container after the title element
titleElement.parentNode.insertBefore(buttonContainer, titleElement.nextSibling);
} else {
console.error("Title element not found. Buttons could not be added.");
}
}
// Helper function to create and style a button
function createButton(buttonText, title, baseUrl, bgColor = '#4CAF50') {
const button = document.createElement('button');
button.innerText = buttonText;
button.style.padding = '10px 15px';
button.style.fontSize = '16px';
button.style.backgroundColor = bgColor;
button.style.color = 'white';
button.style.border = 'none';
button.style.borderRadius = '5px';
button.style.cursor = 'pointer';
// When the button is clicked, open a new tab with the search URL
button.onclick = function() {
const searchUrl = `${baseUrl}${encodeURIComponent(title)}`;
window.open(searchUrl, '_blank');
};
return button;
}
// Wait for the page to fully load before attempting to add the buttons
window.addEventListener('load', addSearchButtons);
})();