#Title Drag import JSON

1 messages ยท Page 1 of 1 (latest)

sudden grove
#

good idea, I might try to module that this weekend.

worldly quail
#

You were exactly the person I was hoping would see this... feels up your alley for some reason

sudden grove
#

I've done drag upload stuff before

worldly quail
#

There's Drag Upload module but that's more for stuff to the canvas

#

Nice, I can't emote in this channel to show my excitement, but it's palpable

sudden grove
#

I know I can do it, just need to see if I can do it without leaving a residual json file somewhere

worldly quail
#

nods

#

I was considering asking in #macro-polo if it would best be a world script, but also kinda wanted awareness of the old import button suggestions in the core git โ€“ those really feel like they should be core by now

sudden grove
#

world scripts are just modules that are hard to distribute

worldly quail
#

exactly... would much prefer a module โ€“ thanks for showing some interest anyway ๐Ÿ™‚

sudden grove
#

thank you, I bore easily so I monitor this channel for module ideas

worldly quail
#

good to know...

sudden grove
worldly quail
sudden grove
#

I think I probably want to do some document type checking because it throws document create errors if you give it the wrong type of document. Won't hurt anything as it is though, probably.

worldly quail
#

That is freaking sensational dude

#

even does rolltables ๐Ÿ™Œ

#

@spark root @molten eagle you probably want to wait for the official module but just so you're aware of this little gamechanger

#

@bitter hornet too... these are the champions that are forever importing JSONs for testing

spark root
#

is this akin to the createitem black magic that tim did with midi?

sudden grove
#

emphasis on little, 13 lines

spark root
#

where you can drag an item to a macro or something

worldly quail
#

you can drag a JSON from your desktop downloads folder or wherever right into the sidebar

#

no more Create Actor/Item/Table > Give it a name > Find it in sidebar > Right click > Locate File > Import

spark root
#

Awwww, i got excited that it was the "make an item in a macro" drag and drop that I had asked about

sudden grove
#

care to explain that a bit better so I can see if it is something I could do?

worldly quail
#

Hey this works with macros too... bless you @sudden grove

molten eagle
#

I am implementing an export/import kind of code for JSON too in a module I am working on ๐Ÿ˜„

sudden grove
#

just takes whatever directory is dropped into and tries to make a document in that collection out of the json

worldly quail
#

amazing

#

@molten eagle you're up to something special over there, can't wait for the release

sudden grove
#

package submitted, should be official soon

molten eagle
#

n1!

worldly quail
#

thanks Xaukael ๐Ÿ™

#

2 hour turnaround

sudden grove
#

would have been sooner, but I was making dinner when I saw it

worldly quail
#

lmao... coded it with one hand while chopping onions

molten eagle
sudden grove
#

nah, I finished eating first

#

what are you printing?

worldly quail
#

๐Ÿ‘€

bitter hornet
#

Oh this is neat

molten eagle
#

Printing the whole macro that is gonna be called so everyone can pretty much see how to do stuff ๐Ÿ˜„

sudden grove
#

๐Ÿ˜•

molten eagle
#

๐Ÿ˜„
its an input for keywords to make something happen...

worldly quail
#

so you're finding a way for us mortals to use the right keywords?

sudden grove
#

looks similar to what I have been doing to cut down on my freeform sheets' updates

#

parsing text and checking values against the document model

#

still don't understand the printing thing

molten eagle
worldly quail
#

that sounds great to me, helping us learn at the same time

sudden grove
worldly quail
#

Happy days!

worldly quail
sudden grove
#
Hooks.on('renderSidebarDirectory', (app, html)=>{
  html.find('.directory-list').on('drop', async function(event){
          event.originalEvent.preventDefault();
          const files = event.originalEvent.dataTransfer.files;
          if (!files[0]) return true;
          const reader = new FileReader();
          reader.addEventListener("load", () => {
            let text = reader.result;
            game[app.tabName].documentClass.create(JSON.parse(text));
          }, false);
          reader.readAsText(files[0]);
  });
});
worldly quail
#

@sudden grove can't seem to install from the setup or the manifest link.... looks like you've linked directly to the .zip

#

(plugged in the manifest manually and it works tho)

sudden grove
#

So I did, just fixed it

worldly quail
#

๐Ÿ‘

sudden grove
#

Thanks for letting me know

worldly quail
#

np, wanted to install it all official-like

south oracle
#

Oh sure, but I'm rewriting it to use no jQuery /s

worldly quail
#

Idk what that means but I appreciate your tone

sudden grove
#

@worldly quail version 1.0.1 will now handle multiple file drops. Not sure why I didn't do that to start

worldly quail
#

I have another idea banked for a handy QOL module if you're interested โ€“ I think it has been attempted before but there's nothing current and it would be better now. A module that registers all the major control tools and sidebar tabs as potential keybinds so users can go into Configure Controls and do as they please

#

There are other modules that get partway there. Monk's Little Details does some... what I like about that module is that you can set them so they're only activated while you're holding

#

I actually feel like this should be core (there must be an issue somewhere on it)

sudden grove
#

I have thought of dynamically generated keybinds before. Not sure how it would work. It is sort of out of my wheelhouse. I am trying to figure out a simple way to recreate the GM Screen module at the moment, even though I have never used it.