Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown parse studio and performer details #4

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
25 changes: 23 additions & 2 deletions dist/public/Stash Markdown.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Stash Markdown
// @namespace https://github.com/7dJx1qP/stash-userscripts
// @description Adds markdown parsing to tag description fields
// @description Adds markdown parsing to tag description, studio and performer detail fields.
// @version 0.1.1
Sz945Kv marked this conversation as resolved.
Show resolved Hide resolved
// @author 7dJx1qP
// @match http://localhost:9999/*
Expand Down Expand Up @@ -43,4 +43,25 @@
}
});
});
})();

stash.addEventListener('page:performer:details', function () {
waitForElementByXpath("//dt[text()='Details']/following-sibling::dd[1]", function (xpath, el) {
processMarkdown(el);
});
})

function studioPageHandler() {
waitForElementByXpath("//dl[contains(@class, 'details-list')]/dd[2]", function (xpath, el) {
processMarkdown(el);
});
}

// Studio details is visible regardless of chosen tab.
stash.addEventListener('page:studio:galleries', studioPageHandler);
stash.addEventListener('page:studio:images', studioPageHandler);
stash.addEventListener('page:studio:performers', studioPageHandler);
stash.addEventListener('page:studio:movies', studioPageHandler);
stash.addEventListener('page:studio:childstudios', studioPageHandler);
stash.addEventListener('page:studio:scenes', studioPageHandler);
stash.addEventListener('page:studio', studioPageHandler);
})();
23 changes: 22 additions & 1 deletion src/body/Stash Markdown.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,25 @@
}
});
});
})();

stash.addEventListener('page:performer:details', function () {
waitForElementByXpath("//dt[text()='Details']/following-sibling::dd[1]", function (xpath, el) {
processMarkdown(el);
});
})

function studioPageHandler() {
waitForElementByXpath("//dl[contains(@class, 'details-list')]/dd[2]", function (xpath, el) {
processMarkdown(el);
});
}

// Studio details is visible regardless of chosen tab.
stash.addEventListener('page:studio:galleries', studioPageHandler);
stash.addEventListener('page:studio:images', studioPageHandler);
stash.addEventListener('page:studio:performers', studioPageHandler);
stash.addEventListener('page:studio:movies', studioPageHandler);
stash.addEventListener('page:studio:childstudios', studioPageHandler);
stash.addEventListener('page:studio:scenes', studioPageHandler);
stash.addEventListener('page:studio', studioPageHandler);
})();