2 questions about extensions

I know why, you don't know polish language. There are arrays that correspond to the following months. Each array contains citations, as many as there are days in a month, there are as many citations. There are functions at the end of the code:
PobierzCytat= DownloadQuote - to chose arguments to show

function PobierzCytat(Sep, lastSep, method) {
	switch (arguments.length) {
		case 0: Sep=null;
		case 1: lastSep=null;
		case 2: method=0;

next, this is grammar function (which is not nesesery for my script)

i    f (method==1)
    		for (var i=0, ch, name, len, last; i<tab.length; i++) {
    			ch=(last=(name=tab[i]).substring((len=name.length)-3)).charAt(2);

			if (last=="ego") { tab[i]=name.substring(0,len-3)+"y";    continue; }
			if (last=="ńca") { tab[i]=name.substring(0,len-3)+"niec"; continue; }
			if (last=="tra") { tab[i]=name.substring(0,len-3)+"ter";  continue; }

			tab[i]=name.substring(0,len-1)+(ch=='a'?"":'a');
		}

Function WypiszCytat = WriteQuote in selected case.

Here is original JS: click (need to translate)

It wasn't the "Polish" that prompted my comment :slight_smile:

Perhaps show/provide a full html file and your shortened quote.js file that works in a browser, I could not get a response using your texts in your posts

(you will need to rename a .html file to .txt)

Ok, i understand. :rofl:
cytat.html.txt (535 bajtów)
cytat.js.txt (149,1 KB)

This solution will run the javascript and return the output to be displayed in an HTMLFormat label

OK, I have figured it out. A couple of issues:

  1. No jquery library in the html file, so switched to plain javascript (in fact, not needed...)
  2. cytat.js is programmed to write to the html file cytat.html, this output is undefined as a string for the webviewstring. Therefore, a small edit is required to the cytat.js file at the bottom, to output a string.

HTML file

<html>
<head>
<meta charset="utf8">
<meta name=“cytat” content=“width=device-width, initial-scale=1.0”>
</head>
<body>

<script src="cytat.js"></script>
<script>
var Label_cytat = WypiszCytat("Myśl na dziś:<br><br>","<br><br>Św. J. S. Pelczar");
window.AppInventor.setWebViewString(Label_cytat);
</script>

</body>
</html>

Change cytat.js:

from this:

document.write(""+before+PobierzCytat(Sep,lastSep,method)+after);

to this

var newStr = ""+before+PobierzCytat(Sep,lastSep,method)+after;
return newStr;

Output in label in app:

image

Revised files:

cytat.html.revised.txt (347 Bytes)
cytat.js.revised.txt (149.1 KB)

1 Like

Big hugs for U. It is working on my Samsung Galaxy Note10+ fine, but on Samsung S7 Edge and on Samsung Tab 2 7" App crash without any message, and exit.

Sorry to hear it doesn't work on all your devices....

Are you using the custom webview extension or the built in webviewer ?

Can't help with the former, but if using the latter, you may want to try running your project on the ai2-test server which has a fix of sorts for the webviewer. Remember to use the specific companion as well.

...built in webviewer...

@TIMAI2 Thank you, I've made it. I just had to use ai2-test server of course.
I have another question. I have made post form for sending posts to the database and I made 'remember me' check. When the user marked the checkbox, it saves the username and city to the database. And now my problem is that when I want to initiate the automatic completion from the database, it does not enter the saved data in the field when I add a rule to Screen1.Initial, but it adds me when I press the 'send' button, and finally after completing the next saved in the field base, will send a post. My blocks for send button looks like:

I have added blocks for saving 'checked' items in the database:

"Check" procedure, which is added to "Screen.Initial", which has the task of loading 'checkbox, checked' from the database and marking it properly when app start:

And the procedure for cleaning saved records in the database, if 'checkbox.checked' = 'false' added to 'Screen.Initial':

And now

I wanted make an initial procedure, so i figured that I have to make blocks like this for the save button (a little change):

And for the initial I add:

But this configurations sends empty fields in name and city which is not desirable.

Any idea?

Better and free sidebar.

https://ullisroboterseite.de/android-AI2-SideBar.html


co.com.dendritas.js.aix (18.0 KB)

I figured out for my empty fields problem. Just made "check" procedure like this:

One more question about @Andres_Cotes paid Sidebar:
I have got some bugs with sidebar when I change theme in app. When I change theme it look like on pictures:
Normal look, after app running:

After change theme:

And after click on sidebar:

When I restart the app, sidebar works fine and looks:

Did someone meet with issue like this? How to resolve it?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.