Skip to content

Commit

Permalink
Support list view in seeding page
Browse files Browse the repository at this point in the history
  • Loading branch information
Morea committed Oct 22, 2023
1 parent a531fdd commit b9c6911
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Find Unique Titles/dist/find.unique.titles.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Find Unique Titles
// @description Find unique titles to cross seed
// @version 0.0.2
// @version 0.0.3
// @author Mea01
// @match https://cinemageddon.net/browse.php*
// @match https://karagarga.in/browse.php*
Expand Down Expand Up @@ -1957,9 +1957,9 @@ class PTP {
getSearchRequest() {
return _wrapAsyncGenerator(function* () {
var requests = [];
var nodes = common__WEBPACK_IMPORTED_MODULE_3__["default"].dom.findFirst("#torrents-movie-view table.torrent_table > tbody", ".cover-movie-list__movie");
var nodes = common__WEBPACK_IMPORTED_MODULE_3__["default"].dom.findFirst(document, "#torrents-movie-view table.torrent_table > tbody", "table.torrent_table > tbody tr.basic-movie-list__details-row", ".cover-movie-list__movie");
nodes === null || nodes === void 0 ? void 0 : nodes.forEach(element => {
var elements = common__WEBPACK_IMPORTED_MODULE_3__["default"].dom.findFirst(".basic-movie-list__movie__ratings-and-tags", ".cover-movie-list__movie__rating-and-tags");
var elements = common__WEBPACK_IMPORTED_MODULE_3__["default"].dom.findFirst(element, ".basic-movie-list__movie__ratings-and-tags", ".cover-movie-list__movie__rating-and-tags");
var imdbId = elements ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__.parseImdbIdFromLink)(elements[0]) : null;
var request = {
torrents: parseTorrents(element),
Expand Down Expand Up @@ -2927,9 +2927,9 @@ const appendErrorMessage = () => {
div.style.color = "white";
addChild(document.body, div);
};
const findFirst = (...selectors) => {
const findFirst = (element, ...selectors) => {
for (let selector of selectors) {
let elements = document.querySelectorAll(selector);
let elements = element.querySelectorAll(selector);
if (elements.length > 0) {
return elements;
}
Expand Down
2 changes: 1 addition & 1 deletion Find Unique Titles/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "find.unique.titles",
"description": "Find unique titles to cross seed",
"version": "0.0.3",
"version": "0.0.4",
"author": {
"name": "Mea01"
},
Expand Down
5 changes: 4 additions & 1 deletion Find Unique Titles/src/trackers/PTP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const parseCategory = (element: HTMLElement): Category => {
".basic-movie-list__torrent-edition__main"
)?.textContent;
if (!categoryTitle) {
return null
return null;
}
if (categoryTitle.includes("Stand-up Comedy ")) {
return Category.STAND_UP;
Expand All @@ -88,11 +88,14 @@ export default class PTP implements tracker {
async *getSearchRequest(): AsyncGenerator<MetaData | Request, void, void> {
const requests: Array<Request> = [];
const nodes = tracker_tools.dom.findFirst(
document,
"#torrents-movie-view table.torrent_table > tbody",
"table.torrent_table > tbody tr.basic-movie-list__details-row",
".cover-movie-list__movie"
);
nodes?.forEach((element: HTMLElement) => {
let elements = tracker_tools.dom.findFirst(
element,
".basic-movie-list__movie__ratings-and-tags",
".cover-movie-list__movie__rating-and-tags"
);
Expand Down
4 changes: 2 additions & 2 deletions common/src/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export const appendErrorMessage = () => {
addChild(document.body, div);
};

export const findFirst = (...selectors: string[]) => {
export const findFirst = (element: Element, ...selectors: string[]) => {
for (let selector of selectors) {
let elements = document.querySelectorAll(selector);
let elements = element.querySelectorAll(selector);
if (elements.length > 0) {
return elements;
}
Expand Down

0 comments on commit b9c6911

Please sign in to comment.