Example javascript code

1,391 views
Skip to first unread message

Miseok Kim

unread,
Sep 19, 2017, 10:37:12 AM9/19/17
to mementodatabase


As a beginner in javascript, memento, I wanted to getsome data by title from particular website
. I found memento.js jn wiki page. But it is hard for me to figure out how it works.
Does anyone have some sample code about access to url and fill data?
It would be helpful for me to understand...

Bill Crews

unread,
Sep 19, 2017, 12:26:17 PM9/19/17
to mementodatabase
Three suggestions:

1. Read about Autofill here: http://wiki.mementodatabase.com/index.php/Library_Edit_screen#AUTOFILL_tab

2. Read about using the Http object here: http://wiki.mementodatabase.com/index.php/Memento_JavaScript_Library#Processing_an_HTTP_request

3. Read examples of the Http object here: http://wiki.mementodatabase.com/index.php/Trigger_Examples#Http_Examples

You may choose Autofill, if it sits you. That would be simplest and probably would not involve any scripting. If scripting _is_ needed, or if you have your own Web site to parse, look up Custom Data Sources in the wiki.

If you have greater needs, the Http object might help, but you'll need to wow choice for that.

Bill Crews

unread,
Sep 19, 2017, 3:11:54 PM9/19/17
to mementodatabase
I don't know what I was trying to say when I said "wow choice", an obvious typo.

If plain Autofill, which works only from certain given Web sites, doesn't suit you, but coding up JavaScript and trying to use an Http object is beyond you, read this: http://wiki.mementodatabase.com/index.php/Data_Sources. Just a little, relatively simple JavaScript can be used to satisfy a need like that. You would be on your own to fetch data from a Web site that was not designed as a data source, and then you can use JavaScript like the first example (where another library is used as the data source) to plug the data into the new entry.

Miseok Kim

unread,
Sep 19, 2017, 8:32:49 PM9/19/17
to mementodatabase
I read all the articles linked. Thanks you very much for your response It helps me a lot with understanding memento database javascript.
Sorry for another question. There was only few JASON examples in wiki page,
1. What should I do to get some element from html like tables on  https://datatables.net/ ?
 I mean I don't know what kind of object the http method response. I've tried getElementById but it failed...
2. The default autofill like books or albums, they had multiple choice in it. what kind of method should I use for it? I thought it was some array but it doesn't work..


Bill Crews

unread,
Sep 20, 2017, 3:47:18 AM9/20/17
to mementodatabase
I would help if I could, but I really don't have a clue. I hope you figure it out and past back to tell us what you learned; I might put that into the wiki.

I'll mention that Memento has a Table View, but I think you're wanting to parse tables on Web sites, which is an entirely different thing.

Hopefully, someone with a clue will respond to this.

Reply all
Reply to author
Forward
0 new messages