removed useless _ folders
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<Solution name="Selfserved_HTML_and_JavaScript">
|
||||
<Project name="Selfserved_HTML_and_JavaScript" path="Selfserved_HTML_and_JavaScript\Selfserved_HTML_and_JavaScript.prj" active="true"/>
|
||||
</Solution>
|
||||
@@ -0,0 +1,68 @@
|
||||
// :CATEGORY:Viewer 2
|
||||
// :NAME:Selfserved_HTML_and_JavaScript
|
||||
// :AUTHOR:Becky Pippen
|
||||
// :CREATED:2010-09-02 11:15:26.630
|
||||
// :EDITED:2013-09-18 15:39:02
|
||||
// :ID:736
|
||||
// :NUM:1004
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Example #1 using script src= and .innerHTML=
|
||||
//
|
||||
// When you can't fit all the JavaScript into one data URI, just move the JavaScript into an external file and reference the file with script src=URL . When the URL refers to the script's own HTTP-in URL, then the page served can contain up to 2K bytes, so you get at least that many bytes plus whatever logic you can fit into the rest of the data URI. If you move that JavaScript to an external web server, the size of the external JavaScript file can be as large as the client web browser can render.
|
||||
//
|
||||
// * Your script can serve an arbitrary number of different pages through one HTTP-in URL by appending a path or parameter to the URL.
|
||||
//
|
||||
// * This works by assigning a string containing HTML to the innerHTML contents of the div element with id "clock". This achieves something similar to the Ajax-like technique published by Tali Rosca and mentioned here. In those techniques, a string is constructed containing an href= tag and an href= that points to the script's HTTP-in URL. That string then replaces the body element using:
|
||||
//
|
||||
// document.getElementsByTagName('body')[0].innerHTML = new-content
|
||||
// :CODE:
|
||||
integer face = 4;
|
||||
|
||||
string myURL;
|
||||
|
||||
|
||||
|
||||
// This can be up to 2KBytes after %-hex-escaping:
|
||||
|
||||
string servedPage = "
|
||||
|
||||
function checklength(i){if (i<10) {i='0'+i;} return i;}
|
||||
|
||||
function clock(){
|
||||
|
||||
var now = new Date();
|
||||
|
||||
var hours = checklength(now.getHours());
|
||||
|
||||
var minutes = checklength(now.getMinutes());
|
||||
|
||||
var seconds = checklength(now.getSeconds());
|
||||
|
||||
var format = 1; //0=24 hour format, 1=12 hour format
|
||||
|
||||
var time;
|
||||
|
||||
if (format == 1) {
|
||||
|
||||
if (hours >= 12) {
|
||||
|
||||
if (hours ==12 ) { hours = 12;
|
||||
|
||||
} else { hours = hours-12; }
|
||||
|
||||
time=hours+':'+minutes+':'+seconds+' PM';
|
||||
|
||||
} else if(hours < 12) {
|
||||
|
||||
if (hours ==0) {hours=12;}
|
||||
|
||||
time=hours+':'+minutes+':'+seconds+' AM';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (format == 0) {time= hours+':'+minutes+':'+seconds;}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
// :CATEGORY:Viewer 2
|
||||
// :NAME:Selfserved_HTML_and_JavaScript
|
||||
// :AUTHOR:Becky Pippen
|
||||
// :CREATED:2010-09-02 11:15:26.630
|
||||
// :EDITED:2013-09-18 15:39:02
|
||||
// :ID:736
|
||||
// :NUM:1005
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Example #2 using body onload= (lag graph example)
|
||||
//
|
||||
// * Like the previous example, this is another variation of how to structure a data URI to serve as a springboard for arbitrarily large pages. In this example, the data URI first uses a script src= tag to read a file of external JavaScript functions in the head element, and then the onload= attribute in body triggers a call to one of the functions which executes a loop creating a bunch of hr elements that form the bar chart. The size of HTML generated by the JavaScript can be as large as the browser permits.
|
||||
// * In this example, jsURL is set to the script's own HTTP-in URL so that the example can be self-contained, but you can point jsURL to an external URL as well. If served by an external server, the JavaScript read in <head> can be as large as the browser permits.
|
||||
// * head can be omitted in the data URI surrounding the script src= tag.
|
||||
// :CODE:
|
||||
integer face = 4;
|
||||
|
||||
string jsURL; // where to fetch external JavaScript
|
||||
|
||||
list numbers;
|
||||
|
||||
integer numSamples = 50;
|
||||
|
||||
|
||||
|
||||
// This is self-served in this example, but can be
|
||||
|
||||
// moved to an external server:
|
||||
|
||||
//
|
||||
|
||||
string externalJavascript()
|
||||
|
||||
{
|
||||
|
||||
return
|
||||
|
||||
"function bar(widthPct,heightPix) {" +
|
||||
|
||||
" document.writeln(\"<hr style='padding:0;margin:0;" +
|
||||
|
||||
" margin-top:-1px;text-align:left;align:left;border=0;" +
|
||||
|
||||
" width:\"+widthPct+\"%;height:\"+heightPix+\"px;" +
|
||||
|
||||
" background-color:#c22;color:#c22;'>\");}" +
|
||||
|
||||
" function graphBars(arr){for(var i=0;i<arr.length;++i)" +
|
||||
|
||||
" {bar(arr[i],18);}}";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
default
|
||||
|
||||
{
|
||||
|
||||
state_entry()
|
||||
|
||||
{
|
||||
|
||||
llClearPrimMedia(face);
|
||||
|
||||
llRequestURL();
|
||||
@@ -0,0 +1,8 @@
|
||||
<Project name="Selfserved_HTML_and_JavaScript" guid="D85F1C8E-6C00-1014-B904-200204C60A89">
|
||||
<Object name="Object" guid="D85F1D75-6C00-1014-B904-200204C60A89">
|
||||
<Script name="Selfserved_HTML_and_JavaScript_1.lsl" guid="D85F3EB7-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
<Script name="Selfserved_HTML_and_JavaScript_2.lsl" guid="D85F63A8-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user