$files = glob("signs/*.png");
for ($i=0; $i<count($files); $i++) { //path to image $image = $files[$i]; //strips path $fname = substr($image, 6); //strips extension $sname = substr($fname, 0, -4); //for onclick $xname = "'" . $sname . "'"; //displays all files and creates clickable link to video of the same name echo '<a href=# ><img src="'.$image .'" onclick="javascript:window.AppInventor.setWebViewString('.$xname .');" alt="sign image" /></a>'. " "; //."<br /><br />"}
<script type="text/javascript" language="javascript">var folder = "signs/";
$.ajax({ url : folder, success: function (data) { $(data).find("a").attr("href", function (i, val) { if( val.match(/\.(jpe?g|png|gif)$/) ) { $("body").append( "<a href=# ><img src='"+ folder + val +"'>" ); } }); }});</script>
<script type="text/javascript" language="javascript">var folder = "signs/";
$.ajax({ url : folder, success: function (data) { $(data).find("a").attr("href", function (i, val) { if( val.match(/\.(jpe?g|png|gif)$/) ) { $("body").append( "<a href=# ><img src='"+ folder + val +"' onclick="javascript:window.AppInventor.setWebViewString( + val +);"></a>" ); } }); }});</script>
Trying to push the limits of App Inventor!
Snippets,
Tutorials and
Extensions from
Pura Vida Apps by
Taifun.
$("body").append( "<a href=# ><img src='"+ folder + val +"' onclick="javascript:window.AppInventor.setWebViewString( + val +);"></a>" );
$("body").append( "<img src='"+ folder + val +"'>" );
$("body").append( "<a href=# ><img src='"+ folder + val +"'></a>" );
myval = "\'"+val+"\'"
myval = "\'"+val+"\'"$("body").append($( '<a href="#"><img src='+ folder + val +' onclick="window.AppInventor.setWebViewString('+myval+')"></a>' ));
<ahref"javascript:;">
generating a web page of images and setting the onclick property of each image with the webstring response
What about not allowing the webviewer to clear the cache unless there is an internet connection, would that allow use when there is not net connection?
<!DOCTYPE html><html>
<head> <meta name="author" content="puravidaapps.com"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> <script src="jquery-1.8.3.min.js"></script> <title>ImageView</title>
<style>img { width:100px; height:100px;}</style> </head>
<body>
<script> $(document).ready(function() { var webString = window.AppInventor.getWebViewString().split(","); $.each( webString, function( index, val ) { myextn = ".png"; myval = "\'"+val+"\'"; $("body").append($( '<a href="javascript:;"><img src='+ val + myextn +' onclick="window.AppInventor.setWebViewString('+ myval +')"></a>' )); }); });
</script>
</body>
</html>