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

First pass at refinery.js #62

Merged
merged 7 commits into from
Apr 13, 2021
Merged

First pass at refinery.js #62

merged 7 commits into from
Apr 13, 2021

Conversation

econti
Copy link
Collaborator

@econti econti commented Apr 13, 2021

example.mov

@econti
Copy link
Collaborator Author

econti commented Apr 13, 2021

example.mov

slow because it's using localhost and not prod

Copy link
Collaborator

@lgvital lgvital left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!!!

static/js/refinery.js Outdated Show resolved Hide resolved
static/js/refinery.js Outdated Show resolved Hide resolved
let changes = response[0].changes;
changes.forEach(change => {
if (window.location.href == change.href) {
let domPath = document.querySelector(change.domPath);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - probably more readable to have this be let elem since it's an HTMLElement that gets loaded up with querySelector

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah nice!

Comment on lines 71 to 86
changes.forEach(change => {
if (window.location.href == change.href) {
let domPath = document.querySelector(change.domPath);
if (domPath.innerHTML != change.beforeHtml) {
console.warn(`Can't apply change on '${change.beforeHtml}' because copy doesn't match.\
'${change.beforeHtml}' vs. '${domPath.innerHTML}'.`);
} else {
domPath.innerHTML = change.afterHtml;
}
} else {
console.warn(`
Can't apply change on '${change.beforeHtml}' because href's don't match.\
'${change.href}' vs. '${window.location.href}'.`);
}
});
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great stuff, we'll probably eventually want to move this into a shareable module so that refinerybrowser can use this (for deleted nodes, prevent accidentally losing changes, etc.)!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! good idea

if (window.location.href == change.href) {
let domPath = document.querySelector(change.domPath);
if (domPath.innerHTML != change.beforeHtml) {
console.warn(`Can't apply change on '${change.beforeHtml}' because copy doesn't match.\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

econti and others added 3 commits April 13, 2021 16:51
@econti econti merged commit 4f839fc into master Apr 13, 2021
@econti econti deleted the refinery.js branch April 13, 2021 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants