[Greasemonkey] Simple file-to-ide sync


#1

Hi there.

I've made a simple userscript which automatically synchronizes selected file and codingame IDE. It adds file input near reload button.

Works with Firefox (with Greasemonkey) and Chrome (with Tampermonkey).

Just click Install and you should get confirmation window (try refreshing opened page if nothing appears). Confirm there and the new input should appear after you refresh an IDE page.

After that you can select a file using the new input and its contents will be automatically synced to the IDE.

Enjoy =)


#2

Could you provide some installation steps?

I am not able to make it working.


#3

@pawellabaj Sure.

1) Install Greasemonkey using this link: https://addons.mozilla.org/en-Us/firefox/addon/greasemonkey/
2) Go to the https://github.com/selslack/codingame-sync-userscript/raw/master/codingame-sync.user.js and you should get an installation window. Confirm there and the new input should appear after you refresh an IDE page.
3) Then you can select a file using the new input and its contents will be automatically synced to the IDE.

Hope that'll help!


#4

Thank you, it works fine.


#5

Hey guys =)

I've fixed a nasty bug which prevented input from showing up unless a page reload is made on the IDE page.

Script now uses MutationObserver API to catch appear and disappear events of the IDE.


#6

Unfortunately, this script is no longer works in firefox 43/44+ (I don't know the exact version).

Firefox now prevents reading changed files. =(


#7

That's sad :frowning:


#8

It works for me in Firefox 49. However, I did notice it doesn't continue to sync after clicking Play so you have to reselect the file. However, it's still better than nothing.