Hi Everyone!
@gomakuma and I will be working on the front-end changes to Lessons that Koichi talked about in Upcoming Front-end Updates. We’ll keep the developer mailing list (make sure to check UserScript Affecting Changes and the forums up to date with our progress along with links to our preview server so you can test your scripts. For now, we wanted to start by giving script authors general guidelines on how to rewrite scripts that could be affected.
Adding CSS
Prefer adding a block or linking to an external stylesheet over adding inline styles to elements. Also keep an eye out for markup changes. (We’ll only make changes if we really have to.)
Manipulating the DOM (ex. deleting or repositioning a div)
We’re still thinking of ways to keep supporting these, but for now, it’ll be safer to do DOM manipulation outside of the React app – maybe in a sibling div, with some styling to make it look similar.
Scripts that substitute global functions with their own functions
window.waniKaniFunction = function(x){
return x;
}
var originalWkFunction = window.waniKaniFunction;
window.waniKaniFunction = function(x){
return originalWkFunction(x) + 1;
}
//or even
window.Math.random = function(){ return 0; };
We could consider keeping some functions exposed, but it’s too early to make guarantees here. Safest assumption is that these won’t be available and you should refactor accordingly. One route that might work which other scripts already use is combining Mutation Observer with jStorage.
Scripts that rely on jStorage
jStorage will continue to be available. Scripts that use it for their own logic and have their own namespace should be okay . Scripts that rely on manipulating jStorage with WaniKani’s own namespace are also ok for now, but this might change in the future.
That’s what we’re thinking for now. In the coming weeks we’ll post updates with more details. Thank you!
EDIT: Updated the example code snippet