Skip to content

Commit

Permalink
add styling to stashbox scene count
Browse files Browse the repository at this point in the history
  • Loading branch information
7dJx1qP committed Feb 13, 2024
1 parent c980e08 commit 377bfbe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions plugins/stashStashboxSceneCount/stashStashboxSceneCount.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
waitForElementClass,
waitForElementByXpath,
getElementByXpath,
insertAfter,
getClosestAncestor,
createElementFromHTML,
updateTextInput,
} = window.stash7dJx1qP;

document.body.appendChild(document.createElement('style')).textContent = `
.stash-id-pill span.stashbox-scene-count { border-radius: .25rem; background-color: #394b59; }
`;

async function runGetStashboxPerformerSceneCountTask(endpoint, api_key, stashId) {
if (endpoint !== 'https://stashdb.org/graphql') return;
return stash.runPluginTask("stashStashboxSceneCount", "Get Stashbox Performer Scene Count", [{"key":"endpoint", "value":{"str": endpoint}}, {"key":"api_key", "value":{"str": api_key}}, {"key":"stash_id", "value":{"str": stashId}}]);
Expand Down Expand Up @@ -149,8 +155,8 @@
const stashBoxSceneCount = await stash.pollLogsForMessage(`[Plugin / Stash Stashbox Scene Count] ${stash_id}: `);
const el = getElementByXpath(`//span[@class='stash-id-pill']/a[text()='${stash_id}']`);
if (el) {
//el.innerText = `${stash_id} ${sceneCount}/${stashBoxSceneCount}`;
el.innerText = `${stash_id} ${stashBoxSceneCount}`;
const badge = createElementFromHTML(`<span class="stashbox-scene-count ml-1">${stashBoxSceneCount}</span>`);
insertAfter(badge, el);
}
}
}
Expand All @@ -170,8 +176,8 @@
const stashBoxSceneCount = await stash.pollLogsForMessage(`[Plugin / Stash Stashbox Scene Count] ${stash_id}: `);
const el = getElementByXpath(`//span[@class='stash-id-pill']/a[text()='${stash_id}']`);
if (el) {
//el.innerText = `${stash_id} ${sceneCount}/${stashBoxSceneCount}`;
el.innerText = `${stash_id} ${stashBoxSceneCount}`;
const badge = createElementFromHTML(`<span class="stashbox-scene-count ml-1">${stashBoxSceneCount}</span>`);
insertAfter(badge, el);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Stash Stashbox Scene Count
# requires: stashUserscriptLibrary7dJx1qP
description: Adds stashbox scene counts to performers and studios
version: 0.2.0
version: 0.2.1
ui:
requires:
- stashUserscriptLibrary7dJx1qP
Expand Down

0 comments on commit 377bfbe

Please sign in to comment.