|
1 | 1 | // ==UserScript== |
2 | 2 | // @name StashDB Submission Helper |
3 | | -// @author mmenanno |
4 | | -// @version 0.7 |
5 | | -// @description Adds button to add all unmatched aliases, measurements, and urls to a performer. |
| 3 | +// @author mmenanno, Emilo |
| 4 | +// @version 0.8 |
| 5 | +// @description Adds button to add all unmatched aliases, measurements, and urls to a performer and scene. |
6 | 6 | // @icon https://raw.githubusercontent.com/stashapp/stash/develop/ui/v2.5/public/favicon.png |
7 | 7 | // @namespace https://github.com/mmenanno |
8 | 8 | // @match https://stashdb.org/drafts/* |
@@ -279,7 +279,7 @@ const urlPatterns = [ |
279 | 279 | // Sougouwiki |
280 | 280 | // Stripchat |
281 | 281 | { |
282 | | - pattern: /(https?:\/\/www.thenude.com\/[^?]+\.htm)/, |
| 282 | + pattern: /(https?:\/\/www.thenude.(?:com|eu)\/[^?]+\.htm)/, |
283 | 283 | site: "theNude", |
284 | 284 | }, |
285 | 285 | // ThePornDB |
@@ -336,7 +336,7 @@ function urlSite(url) { |
336 | 336 | } |
337 | 337 | } |
338 | 338 |
|
339 | | - return "Studio Profile"; |
| 339 | + return pageType() == "Performer" ? "Studio Profile" : "Studio"; |
340 | 340 | } |
341 | 341 |
|
342 | 342 | function siteMatch(url, selections) { |
@@ -366,6 +366,10 @@ function addUrl(url) { |
366 | 366 | const addButton = urlInput.children[3]; |
367 | 367 |
|
368 | 368 | const selection = siteMatch(url, selections); |
| 369 | + if (!selection) { |
| 370 | + console.warn("Invalid selection"); |
| 371 | + return; |
| 372 | + } |
369 | 373 | setNativeValue(selections, selection.value); |
370 | 374 | setNativeValue(inputField, url); |
371 | 375 | if (addButton.disabled) { |
@@ -525,16 +529,27 @@ function performerEditPage() { |
525 | 529 | } |
526 | 530 |
|
527 | 531 | function sceneEditPage() { |
528 | | - return; |
| 532 | + const urlsValues = unmatchedTargetValue("Urls"); |
| 533 | + if (urlsValues != null) { |
| 534 | + const unmatchedUrls = urlsValues.split(", "); |
| 535 | + if (unmatchedUrls) { |
| 536 | + const umatchedUrlsElement = unmatchedTargetElement("Urls"); |
| 537 | + makeUrlLink(umatchedUrlsElement); |
| 538 | + } |
| 539 | + const urlsElement = unmatchedTargetButton("Urls"); |
| 540 | + createUrlsButton(unmatchedUrls, urlsElement); |
| 541 | + } |
529 | 542 | } |
530 | 543 |
|
| 544 | +const formSelector = ".NarrowPage form"; |
| 545 | + |
531 | 546 | function pageType() { |
532 | 547 | return document |
533 | | - .querySelector(".NarrowPage form") |
| 548 | + .querySelector(formSelector) |
534 | 549 | .className.replace("Form", ""); |
535 | 550 | } |
536 | 551 |
|
537 | | -waitForElm(aliasInputSelector).then(() => { |
| 552 | +waitForElm(formSelector).then(() => { |
538 | 553 | if (pageType() == "Performer") { |
539 | 554 | performerEditPage(); |
540 | 555 | } else if (pageType() == "Scene") { |
|
0 commit comments