Skip to content

Instantly share code, notes, and snippets.

@lucianonooijen
Created November 2, 2018 15:45
Show Gist options
  • Select an option

  • Save lucianonooijen/8de3760cf768ff542ed32e9918318553 to your computer and use it in GitHub Desktop.

Select an option

Save lucianonooijen/8de3760cf768ff542ed32e9918318553 to your computer and use it in GitHub Desktop.
Clockify create screenshotable page
// Simulate Click
const simulateClick = function (elem) {
// Create our event (with options)
const evt = new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
});
// If cancelled, don't dispatch our event
const canceled = !elem.dispatchEvent(evt);
};
const openAllButton = document.querySelector('.dashboard__filter--container > div:nth-child(1)');
simulateClick(openAllButton);
// Set correct title
document.querySelector('.grouped__by__title').innerHTML = 'Detailed overview';
// Set CSS
const css = document.createElement("style");
css.type = "text/css";
css.innerHTML = `
.report-actions__container,
.default-layout--sidebar,
.dashboard__title,
.reports--datepicker,
.report__filter,
.square,
.group__by__separation--hourly__rate,
.group__by__separation--billable,
.dashboard__project-data--details span:nth-child(4),
.grouped__by__title::after {
display: none !important;
}
.dashboard__project-data > div:nth-child(2) > span:nth-child(2) {
font-weight: bold !important;
}
.dashboard__project-data > div:nth-child(2) > span:nth-child(3) {
font-style: italic;
width: 100px;
font-size: 0.8em;
}
.report__panel {
margin-top: 20px;
}
.default-layout .default-layout--router {
margin-left: 0 !important;
width: 100% !important;
}
`;
document.body.appendChild(css);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment