Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions userscripts/StashDB_Submission_Helper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ https://discourse.stashapp.cc/t/stashdb-submission-helper/1417
- Adds button to add all unmatched aliases to performer
- Adds button to add all unmatched urls to performer
- Adds button to add all unmatched measurements to performer (if they match expected formats)
- Adds button to add all unmatched urls to scene
- Convert unmatched urls from regular strings to linked strings

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

## Changelog

### 0.8
- Support scene URLS

### 0.7
- Allow alias separator to also be `/` or ` or ` (space on either side of the or).
- Allow measurements to be added without the cup size
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// ==UserScript==
// @name StashDB Submission Helper
// @author mmenanno
// @version 0.7
// @description Adds button to add all unmatched aliases, measurements, and urls to a performer.
// @author mmenanno, Emilo
// @version 0.8
// @description Adds button to add all unmatched aliases, measurements, and urls to a performer and scene.
// @icon https://raw.githubusercontent.com/stashapp/stash/develop/ui/v2.5/public/favicon.png
// @namespace https://github.com/mmenanno
// @match https://stashdb.org/drafts/*
Expand Down Expand Up @@ -279,7 +279,7 @@ const urlPatterns = [
// Sougouwiki
// Stripchat
{
pattern: /(https?:\/\/www.thenude.com\/[^?]+\.htm)/,
pattern: /(https?:\/\/www.thenude.(?:com|eu)\/[^?]+\.htm)/,
site: "theNude",
},
// ThePornDB
Expand Down Expand Up @@ -336,7 +336,7 @@ function urlSite(url) {
}
}

return "Studio Profile";
return pageType() == "Performer" ? "Studio Profile" : "Studio";
}

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

const selection = siteMatch(url, selections);
if (!selection) {
console.warn("Invalid selection");
return;
}
setNativeValue(selections, selection.value);
setNativeValue(inputField, url);
if (addButton.disabled) {
Expand Down Expand Up @@ -525,16 +529,27 @@ function performerEditPage() {
}

function sceneEditPage() {
return;
const urlsValues = unmatchedTargetValue("Urls");
if (urlsValues != null) {
const unmatchedUrls = urlsValues.split(", ");
if (unmatchedUrls) {
const umatchedUrlsElement = unmatchedTargetElement("Urls");
makeUrlLink(umatchedUrlsElement);
}
const urlsElement = unmatchedTargetButton("Urls");
createUrlsButton(unmatchedUrls, urlsElement);
}
}

const formSelector = ".NarrowPage form";

function pageType() {
return document
.querySelector(".NarrowPage form")
.querySelector(formSelector)
.className.replace("Form", "");
}

waitForElm(aliasInputSelector).then(() => {
waitForElm(formSelector).then(() => {
if (pageType() == "Performer") {
performerEditPage();
} else if (pageType() == "Scene") {
Expand Down