Use "seen" on the trail in KRL

I want to have a footprint that helps keep track of the values ​​that I want to keep for users. If the user has not provided his name, I want to display a form for entering the name that will be used for search.

I want to check if the name is in the trail. If the name is in the trail, then display the data for this user. If the name is not on the trail, I want to display the form so that they can enter their name.

I am looking for some help in how I accomplished this. It was suggested to encode the structure as json and push it to the trail, and then look for it. Some direction on how this would be done would be helpful. Do I use the following:

if seen ent:user_data with <regexp> then {
   <get and show data>
} else {
   <show form to user>
}
+3
source share
1

, -

:

savedName =  ent:userName || "";

postlude :

set ent:userName userName;
clear ent:userName;

app = > https://gist.github.com/722849

bookmarklet = > http://mikegrace.s3.amazonaws.com/forums/stack-overflow/example-persistant-trail-bookmarklet.html

http://example.com

  • example.com

first run on example.com

after clicking submit

running app again after roload

  • , yahoo.com

alt text

  • yahoo.com

alt text

Note. . If you want to keep something else, like age, you can just use another entity variable, like

ent:userAge

Heaven is the limit .; )

+3
source

Source: https://habr.com/ru/post/1777824/


All Articles