Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
7dJx1qP committed Feb 4, 2024
2 parents 3a2e737 + 7ff7531 commit d330322
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.24.0 Stash Userscripts Bundle
### 0.6.0 Stash Batch Result Toggle
#### Changed
- Added director and studio code toggling
### 0.7.0 Stash Scene Tagger Colorizer
#### Changed
- Added director and studio code coloring

## 0.23.0 Stash Userscripts Bundle
### 0.1.0 Stash Markers Autoscroll
#### Added
Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GITHUB_ROOT_URL = r"https://raw.githubusercontent.com/7dJx1qP/stash-userscripts/%%BRANCH%%/"
BUNDLE_VERSION = "0.23.0"
BUNDLE_VERSION = "0.24.0"
SERVER_URL = "http://localhost:9999"
NAMESPACE = "https://github.com/7dJx1qP/stash-userscripts"
24 changes: 22 additions & 2 deletions dist/public/Stash Batch Result Toggle.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name Stash Batch Result Toggle
// @namespace https://github.com/7dJx1qP/stash-userscripts
// @description Batch toggle scene tagger search result fields
// @version 0.5.0
// @version 0.6.0
// @author 7dJx1qP
// @match http://localhost:9999/*
// @grant unsafeWindow
Expand Down Expand Up @@ -76,7 +76,11 @@
dateNode,
studioNode,
performerNodes: matchPerformerNodes,
matches
matches,
tagNodes,
unmatchedTagNodes,
studioCodeNode,
directorNode
} = stash.parseSearchResultItem(searchResultItem);

const studioMatchNode = matches.find(o => o.matchType === 'studio')?.matchNode;
Expand All @@ -90,6 +94,8 @@
const includeDetails = document.getElementById('result-toggle-details').checked;
const includeStudio = document.getElementById('result-toggle-studio').checked;
const includePerformers = document.getElementById('result-toggle-performers').checked;
const includeStudioCode = document.getElementById('result-toggle-studio-code').checked;
const includeDirector = document.getElementById('result-toggle-director').checked;

let options = [];

Expand All @@ -101,6 +107,8 @@
options.push(['details', includeDetails, detailsNode, resolveToggle(detailsNode)]);
options.push(['studio', includeStudio, studioMatchNode, resolveToggle(studioMatchNode)]);
options = options.concat(performerMatchNodes.map(o => ['performer', includePerformers, o, resolveToggle(o)]));
options.push(['studio-code', includeStudioCode, studioCodeNode, resolveToggle(studioCodeNode)]);
options.push(['director', includeDirector, directorNode, resolveToggle(directorNode)]);

for (const [optionType, optionValue, optionNode, { button, state }] of options) {
let wantedState = optionValue;
Expand Down Expand Up @@ -300,6 +308,18 @@
<label title="" for="result-toggle-performers" class="form-check-label">Performers</label>
</div>
</div>
<div class="align-items-center form-group col-md-6">
<div class="form-check">
<input type="checkbox" id="result-toggle-studio-code" class="form-check-input" data-default="true">
<label title="" for="result-toggle-studio-code" class="form-check-label">Studio Code</label>
</div>
</div>
<div class="align-items-center form-group col-md-6">
<div class="form-check">
<input type="checkbox" id="result-toggle-director" class="form-check-input" data-default="true">
<label title="" for="result-toggle-director" class="form-check-label">Director</label>
</div>
</div>
</div>
</div>
`);
Expand Down
34 changes: 32 additions & 2 deletions dist/public/Stash Scene Tagger Colorizer.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name Stash Scene Tagger Colorizer
// @namespace https://github.com/7dJx1qP/stash-userscripts
// @description Colorize scene tagger match results to show matching and mismatching scene data.
// @version 0.6.0
// @version 0.7.0
// @author 7dJx1qP
// @match http://localhost:9999/*
// @grant unsafeWindow
Expand Down Expand Up @@ -183,7 +183,9 @@
performerNodes: matchPerformerNodes,
matches,
tagNodes: matchTagNodes,
unmatchedTagNodes
unmatchedTagNodes,
studioCodeNode,
directorNode
} = stash.parseSearchResultItem(searchResultItem);

const includeTitle = document.getElementById('colorize-title').checked;
Expand All @@ -194,6 +196,8 @@
const includeStudio = document.getElementById('colorize-studio').checked;
const includePerformers = document.getElementById('colorize-performers').checked;
const includeTags = document.getElementById('colorize-tags').checked;
const includeStudioCode = document.getElementById('colorize-studio-code').checked;
const includeDirector = document.getElementById('colorize-director').checked;

if (includeTitle && titleNode) {
titleNode.firstChild.style.color = COLORS.yellow;
Expand Down Expand Up @@ -300,6 +304,20 @@
}
}

if (includeStudioCode && studioCodeNode) {
studioCodeNode.style.color = COLORS.yellow;
if (data?.code) {
studioCodeNode.style.color = studioCodeNode.textContent === data.code ? COLORS.green : COLORS.red;
}
}

if (includeDirector && directorNode) {
directorNode.style.color = COLORS.yellow;
if (data?.director) {
directorNode.style.color = directorNode.textContent === 'Director: ' + data.director ? COLORS.green : COLORS.red;
}
}

}

const colorizeConfigId = 'colorize-config';
Expand Down Expand Up @@ -360,6 +378,18 @@
<label title="" for="colorize-tags" class="form-check-label">Tags</label>
</div>
</div>
<div class="align-items-center form-group col-md-6">
<div class="form-check">
<input type="checkbox" id="colorize-studio-code" class="form-check-input" data-default="true">
<label title="" for="colorize-studio-code" class="form-check-label">Studio Code</label>
</div>
</div>
<div class="align-items-center form-group col-md-6">
<div class="form-check">
<input type="checkbox" id="colorize-director" class="form-check-input" data-default="true">
<label title="" for="colorize-director" class="form-check-label">Director</label>
</div>
</div>
<div class="align-items-center form-group col-md-12">
<div class="row">
<label title="" for="colorize-color-green" class="col-sm-2 col-form-label">Match Color</label>
Expand Down
2 changes: 1 addition & 1 deletion dist/public/Stash Userscripts Bundle.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name Stash Userscripts Bundle
// @namespace https://github.com/7dJx1qP/stash-userscripts
// @description Stash Userscripts Bundle
// @version 0.23.0
// @version 0.24.0
// @author 7dJx1qP
// @match http://localhost:9999/*
// @resource IMPORTED_CSS https://raw.githubusercontent.com/fengyuanchen/cropperjs/main/dist/cropper.min.css
Expand Down
21 changes: 18 additions & 3 deletions src/StashUserscriptLibrary.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Stash Userscript Library
// Exports utility functions and a Stash class that emits events whenever a GQL response is received and whenenever a page navigation change is detected
// version 0.35.0
// version 0.36.0

(function () {
'use strict';
Expand Down Expand Up @@ -918,7 +918,20 @@

const metadataNode = searchResultItem.querySelector('.scene-metadata');
const titleNode = metadataNode.querySelector('h4 .optional-field .optional-field-content');
const dateNode = metadataNode.querySelector('h5 .optional-field .optional-field-content');
let dateNode;
let studioCodeNode;
let directorNode;
for (const node of searchResultItem.querySelectorAll('h5 .optional-field .optional-field-content')) {
if (node.innerText === remoteData.date) {
dateNode = node;
}
else if (node.innerText === remoteData.code) {
studioCodeNode = node;
}
else if (node.innerText === 'Director: ' + remoteData.director) {
directorNode = node;
}
}

const entityNodes = searchResultItem.querySelectorAll('.entity-name');
let studioNode = null;
Expand Down Expand Up @@ -983,7 +996,9 @@
performerNodes,
matches,
tagNodes,
unmatchedTagNodes
unmatchedTagNodes,
studioCodeNode,
directorNode
}
}
}
Expand Down
22 changes: 21 additions & 1 deletion src/body/Stash Batch Result Toggle.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@
dateNode,
studioNode,
performerNodes: matchPerformerNodes,
matches
matches,
tagNodes,
unmatchedTagNodes,
studioCodeNode,
directorNode
} = stash.parseSearchResultItem(searchResultItem);

const studioMatchNode = matches.find(o => o.matchType === 'studio')?.matchNode;
Expand All @@ -77,6 +81,8 @@
const includeDetails = document.getElementById('result-toggle-details').checked;
const includeStudio = document.getElementById('result-toggle-studio').checked;
const includePerformers = document.getElementById('result-toggle-performers').checked;
const includeStudioCode = document.getElementById('result-toggle-studio-code').checked;
const includeDirector = document.getElementById('result-toggle-director').checked;

let options = [];

Expand All @@ -88,6 +94,8 @@
options.push(['details', includeDetails, detailsNode, resolveToggle(detailsNode)]);
options.push(['studio', includeStudio, studioMatchNode, resolveToggle(studioMatchNode)]);
options = options.concat(performerMatchNodes.map(o => ['performer', includePerformers, o, resolveToggle(o)]));
options.push(['studio-code', includeStudioCode, studioCodeNode, resolveToggle(studioCodeNode)]);
options.push(['director', includeDirector, directorNode, resolveToggle(directorNode)]);

for (const [optionType, optionValue, optionNode, { button, state }] of options) {
let wantedState = optionValue;
Expand Down Expand Up @@ -287,6 +295,18 @@
<label title="" for="result-toggle-performers" class="form-check-label">Performers</label>
</div>
</div>
<div class="align-items-center form-group col-md-6">
<div class="form-check">
<input type="checkbox" id="result-toggle-studio-code" class="form-check-input" data-default="true">
<label title="" for="result-toggle-studio-code" class="form-check-label">Studio Code</label>
</div>
</div>
<div class="align-items-center form-group col-md-6">
<div class="form-check">
<input type="checkbox" id="result-toggle-director" class="form-check-input" data-default="true">
<label title="" for="result-toggle-director" class="form-check-label">Director</label>
</div>
</div>
</div>
</div>
`);
Expand Down
32 changes: 31 additions & 1 deletion src/body/Stash Scene Tagger Colorizer.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@
performerNodes: matchPerformerNodes,
matches,
tagNodes: matchTagNodes,
unmatchedTagNodes
unmatchedTagNodes,
studioCodeNode,
directorNode
} = stash.parseSearchResultItem(searchResultItem);

const includeTitle = document.getElementById('colorize-title').checked;
Expand All @@ -181,6 +183,8 @@
const includeStudio = document.getElementById('colorize-studio').checked;
const includePerformers = document.getElementById('colorize-performers').checked;
const includeTags = document.getElementById('colorize-tags').checked;
const includeStudioCode = document.getElementById('colorize-studio-code').checked;
const includeDirector = document.getElementById('colorize-director').checked;

if (includeTitle && titleNode) {
titleNode.firstChild.style.color = COLORS.yellow;
Expand Down Expand Up @@ -287,6 +291,20 @@
}
}

if (includeStudioCode && studioCodeNode) {
studioCodeNode.style.color = COLORS.yellow;
if (data?.code) {
studioCodeNode.style.color = studioCodeNode.textContent === data.code ? COLORS.green : COLORS.red;
}
}

if (includeDirector && directorNode) {
directorNode.style.color = COLORS.yellow;
if (data?.director) {
directorNode.style.color = directorNode.textContent === 'Director: ' + data.director ? COLORS.green : COLORS.red;
}
}

}

const colorizeConfigId = 'colorize-config';
Expand Down Expand Up @@ -347,6 +365,18 @@
<label title="" for="colorize-tags" class="form-check-label">Tags</label>
</div>
</div>
<div class="align-items-center form-group col-md-6">
<div class="form-check">
<input type="checkbox" id="colorize-studio-code" class="form-check-input" data-default="true">
<label title="" for="colorize-studio-code" class="form-check-label">Studio Code</label>
</div>
</div>
<div class="align-items-center form-group col-md-6">
<div class="form-check">
<input type="checkbox" id="colorize-director" class="form-check-input" data-default="true">
<label title="" for="colorize-director" class="form-check-label">Director</label>
</div>
</div>
<div class="align-items-center form-group col-md-12">
<div class="row">
<label title="" for="colorize-color-green" class="col-sm-2 col-form-label">Match Color</label>
Expand Down
2 changes: 1 addition & 1 deletion src/header/Stash Batch Result Toggle.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name Stash Batch Result Toggle
// @namespace %NAMESPACE%
// @description Batch toggle scene tagger search result fields
// @version 0.5.0
// @version 0.6.0
// @author 7dJx1qP
// @match %MATCHURL%
// @grant unsafeWindow
Expand Down
2 changes: 1 addition & 1 deletion src/header/Stash Scene Tagger Colorizer.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name Stash Scene Tagger Colorizer
// @namespace %NAMESPACE%
// @description Colorize scene tagger match results to show matching and mismatching scene data.
// @version 0.6.0
// @version 0.7.0
// @author 7dJx1qP
// @match %MATCHURL%
// @grant unsafeWindow
Expand Down

0 comments on commit d330322

Please sign in to comment.