document.addEventListener("keypress", (e) => {
if (e.keyCode != 92) return;
const queryPrefix = document
.querySelector("body > yurt-root-app")
.shadowRoot.querySelector("redux-provider > yurt-root-app-connected")
.shadowRoot.querySelector(
"tcs-view > app-drawer-layout > app-header-layout > yurt-core-router"
)
.shadowRoot.querySelector("yurt-review-root")
.shadowRoot.querySelector("tcs-view > yurt-root-plugin-manager")
.shadowRoot.querySelector("div > yurt-video-root");
try {
const status = queryPrefix.shadowRoot
.querySelector(
"yurt-review-layout > tcs-view:nth-child(2) > yurt-video-metadata-panel"
)
.shadowRoot.querySelector("div.video > yurt-video-metadata-video")
.shadowRoot.querySelector(
"tcs-labeled-list > tcs-labeled-list-item:nth-child(1) > yurt-core-video-status-badge"
)
.shadowRoot.querySelector("span");
status.style.fontSize = "2.5em";
if (status.textContent === "Not Available") {
status.style.backgroundColor = "red";
}
} catch (e) {}
if (
queryPrefix.shadowRoot
.querySelector(
"yurt-review-layout > tcs-view:nth-child(2) > yurt-video-metadata-panel"
)
.shadowRoot.querySelector("div.video > yurt-video-metadata-video")
.shadowRoot.querySelector("#decision-panel-custom")
) {
return;
}
if (
document
.querySelector("body > yurt-root-app")
.shadowRoot.querySelector("redux-provider > yurt-root-app-connected")
.shadowRoot.querySelector(
"tcs-view > app-drawer-layout > app-header-layout > yurt-core-router"
)
.shadowRoot.querySelector("yurt-review-root")
.shadowRoot.querySelector("tcs-view > yurt-root-plugin-manager")
.shadowRoot.querySelector("div > yurt-video-root")
.shadowRoot.querySelector(
"yurt-review-layout > tcs-view:nth-child(1) > yurt-video-header"
)
.shadowRoot.querySelector(
"yurt-core-plugin-header > div > yurt-core-header-title-caption"
)
.shadowRoot.querySelector("div")
.textContent.includes("Metrics")
) {
return;
}
const targetElement = queryPrefix.shadowRoot
.querySelector(
"yurt-review-layout > tcs-view:nth-child(2) > yurt-video-metadata-panel"
)
.shadowRoot.querySelector("div.video > yurt-video-metadata-video")
.shadowRoot.querySelector("tcs-view:nth-child(3)");
const buttonsContainer = document.createElement("div");
buttonsContainer.setAttribute("id", "decision-panel-custom");
buttonsContainer.style.display = "flex";
buttonsContainer.style.gap = "10px";
buttonsContainer.style.flexWrap = "wrap";
const decisions = [
{
text: "minor 9008",
action: async () => await approve()
},
{
text: "minor 1022",
action: async () => await harmfulDangerous()
},
{
text: "minor 1032",
action: async () => await reject()
},
{ text: "minor 1029", action: () => console.log("Action 2") },
{ text: "minor 1004", action: () => console.log("Action 2") },
{ text: "minor 1026", action: () => console.log("Action 2") },
{ text: "minor 1019", action: () => console.log("Action 2") },
{ text: "minor 1030", action: () => console.log("Action 2") }
];
decisions.forEach((decision, index) => {
const button = document.createElement("button");
button.textContent = decision.text;
button.style.backgroundColor = "black";
button.style.color = "white";
button.style.borderRadius = "5px";
button.style.padding = "3px 10px";
button.style.border = "2px solid white";
button.style.width = "40%";
button.style.cursor = "pointer";
button.style.boxSizing = "border-box";
button.style.flex = "1 1 30px";
button.addEventListener("click", decision.action);
buttonsContainer.appendChild(button);
});
targetElement.appendChild(buttonsContainer);
const performClick = async (element) => {
if (!element) return;
try {
await element.click();
} catch (e) {}
};
const performStartingActions = async () => {
const myReview = queryPrefix.shadowRoot
?.querySelector(
"yurt-review-layout > tcs-view:nth-child(4) > yurt-video-decision-panel-v2"
)
?.shadowRoot.querySelector("yurt-core-decision-annotation-tabs")
?.shadowRoot.querySelector("#mdc-tab-36");
const addReview = queryPrefix.shadowRoot
?.querySelector(
"yurt-review-layout > tcs-view:nth-child(4) > yurt-video-decision-panel-v2"
)
?.shadowRoot.querySelector(
"yurt-core-decision-annotation-tabs > div.container > yurt-core-decision-add-review"
)
?.shadowRoot.querySelector("tcs-button");
const realMinorBtn = queryPrefix.shadowRoot
?.querySelector(
"yurt-review-layout > tcs-view:nth-child(4) > yurt-video-decision-panel-v2"
)
?.shadowRoot.querySelector("yurt-core-questionnaire")
?.shadowRoot.querySelector(
"div.questionnaire-content.questionnaire-content-with-helpcenter > yurt-core-label-questionnaire-question-type-mapper.current-question-set"
)
?.shadowRoot.querySelector(
"yurt-core-label-questionnaire-timeline > yurt-core-label-questionnaire-single-choice"
)
?.shadowRoot.querySelector("#real_minor");
await performClick(myReview);
await performClick(addReview);
await performClick(realMinorBtn);
};
const performEndingActions = async () => {
const shadowRootPrefix = queryPrefix.shadowRoot?.querySelector(
"yurt-review-layout > tcs-view:nth-child(4) > yurt-video-decision-panel-v2"
);
const questionnaireButton = shadowRootPrefix.shadowRoot
?.querySelector("yurt-core-questionnaire")
?.shadowRoot.querySelector(
"div.questionnaire-navigation > div > slot > tcs-button"
);
const acceptPolicyButton = shadowRootPrefix.shadowRoot
?.querySelector(
"yurt-core-decision-annotation-edit > yurt-video-decision-policy-edit"
)
?.shadowRoot.querySelector("#decision-panel-policy-edit")
?.shadowRoot.querySelector("#decision-panel-policy-selector")
?.shadowRoot.querySelector(
"tcs-view:nth-child(2) > div > yurt-core-policy-selector-item"
);
const saveButton = shadowRootPrefix.shadowRoot
?.querySelector("yurt-core-decision-annotation-edit")
?.shadowRoot.querySelector("div.action-buttons > tcs-button.save-button");
const submitButton = shadowRootPrefix.shadowRoot
?.querySelector("yurt-core-decision-submit-panel")
?.shadowRoot.querySelector("div > tcs-dropdown-button")
?.shadowRoot.querySelector("div > tcs-view > tcs-button");
await performClick(questionnaireButton);
await performClick(acceptPolicyButton);
await performClick(saveButton);
await performClick(submitButton);
};
const approve = async () => {
const shadowRootPrefix = queryPrefix.shadowRoot
?.querySelector(
"yurt-review-layout > tcs-view:nth-child(4) > yurt-video-decision-panel-v2"
)
?.shadowRoot.querySelector("yurt-core-questionnaire")
?.shadowRoot.querySelector(
"div.questionnaire-content.questionnaire-content-with-helpcenter > yurt-core-label-questionnaire-question-type-mapper.current-question-set"
)
?.shadowRoot.querySelector(
"yurt-core-label-questionnaire-timeline > yurt-core-label-questionnaire-single-choice"
);
const noneOfTheAbove = shadowRootPrefix?.shadowRoot?.querySelector(
"#none_of_the_above"
);
await performStartingActions();
await performClick(noneOfTheAbove);
await performEndingActions();
};
const harmfulDangerous = async () => {
const shadowRootPrefix = queryPrefix.shadowRoot
?.querySelector(
"yurt-review-layout > tcs-view:nth-child(4) > yurt-video-decision-panel-v2"
)
?.shadowRoot.querySelector("yurt-core-questionnaire")
?.shadowRoot.querySelector(
"div.questionnaire-content.questionnaire-content-with-helpcenter > yurt-core-label-questionnaire-question-type-mapper.current-question-set"
)
?.shadowRoot.querySelector(
"yurt-core-label-questionnaire-timeline > yurt-core-label-questionnaire-single-choice"
);
const minorHD = shadowRootPrefix?.shadowRoot
.querySelector("#minors_hd_acts")
?.shadowRoot.querySelector("tcs-text-transform")
?.shadowRoot.querySelector("span");
const dangerousSubstance = shadowRootPrefix?.shadowRoot?.querySelector(
"#dangerous_substance_consumption_tobacco_alcohol_or_drugs"
);
const no = shadowRootPrefix?.shadowRoot?.querySelector("#no");
await performClick(no);
await performStartingActions();
await performClick(minorHD);
await performClick(dangerousSubstance);
await performEndingActions();
};
const reject = async () => {
await performStartingActions();
await performEndingActions();
};
});