-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
slow because it's using localhost and not prod |
There was a problem hiding this 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
let changes = response[0].changes; | ||
changes.forEach(change => { | ||
if (window.location.href == change.href) { | ||
let domPath = document.querySelector(change.domPath); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah nice!
static/js/refinery.js
Outdated
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}'.`); | ||
} | ||
}); | ||
}); |
There was a problem hiding this comment.
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.)!
There was a problem hiding this comment.
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.\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
Co-authored-by: Lionel Vital <[email protected]>
Co-authored-by: Lionel Vital <[email protected]>
example.mov