Skip to content

Commit d6f4db8

Browse files
authored
Add scene URLs support for StashDB Submission Helper (#701)
1 parent 73e1efe commit d6f4db8

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

userscripts/StashDB_Submission_Helper/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ https://discourse.stashapp.cc/t/stashdb-submission-helper/1417
55
- Adds button to add all unmatched aliases to performer
66
- Adds button to add all unmatched urls to performer
77
- Adds button to add all unmatched measurements to performer (if they match expected formats)
8+
- Adds button to add all unmatched urls to scene
89
- Convert unmatched urls from regular strings to linked strings
910

1011
## [**INSTALL USERSCRIPT**](https://raw.githubusercontent.com/stashapp/CommunityScripts/main/userscripts/StashDB_Submission_Helper/stashdb_submission_helper.user.js)
@@ -19,6 +20,9 @@ Installation requires a browser extension such as [Violentmonkey](https://violen
1920

2021
## Changelog
2122

23+
### 0.8
24+
- Support scene URLS
25+
2226
### 0.7
2327
- Allow alias separator to also be `/` or ` or ` (space on either side of the or).
2428
- Allow measurements to be added without the cup size

userscripts/StashDB_Submission_Helper/stashdb_submission_helper.user.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// ==UserScript==
22
// @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.
66
// @icon https://raw.githubusercontent.com/stashapp/stash/develop/ui/v2.5/public/favicon.png
77
// @namespace https://github.com/mmenanno
88
// @match https://stashdb.org/drafts/*
@@ -279,7 +279,7 @@ const urlPatterns = [
279279
// Sougouwiki
280280
// Stripchat
281281
{
282-
pattern: /(https?:\/\/www.thenude.com\/[^?]+\.htm)/,
282+
pattern: /(https?:\/\/www.thenude.(?:com|eu)\/[^?]+\.htm)/,
283283
site: "theNude",
284284
},
285285
// ThePornDB
@@ -336,7 +336,7 @@ function urlSite(url) {
336336
}
337337
}
338338

339-
return "Studio Profile";
339+
return pageType() == "Performer" ? "Studio Profile" : "Studio";
340340
}
341341

342342
function siteMatch(url, selections) {
@@ -366,6 +366,10 @@ function addUrl(url) {
366366
const addButton = urlInput.children[3];
367367

368368
const selection = siteMatch(url, selections);
369+
if (!selection) {
370+
console.warn("Invalid selection");
371+
return;
372+
}
369373
setNativeValue(selections, selection.value);
370374
setNativeValue(inputField, url);
371375
if (addButton.disabled) {
@@ -525,16 +529,27 @@ function performerEditPage() {
525529
}
526530

527531
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+
}
529542
}
530543

544+
const formSelector = ".NarrowPage form";
545+
531546
function pageType() {
532547
return document
533-
.querySelector(".NarrowPage form")
548+
.querySelector(formSelector)
534549
.className.replace("Form", "");
535550
}
536551

537-
waitForElm(aliasInputSelector).then(() => {
552+
waitForElm(formSelector).then(() => {
538553
if (pageType() == "Performer") {
539554
performerEditPage();
540555
} else if (pageType() == "Scene") {

0 commit comments

Comments
 (0)