[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Ruby in Browsers?

Peña, Botp

2/8/2006 6:24:00 AM

petermichaux@yahoo.com [mailto:petermichaux@yahoo.com]

#Any moves out there to get Ruby imbeded in browsers?
#
#How about Ruby as a client-side scripting web standard? (Maybe it would
#have to be Ruby Light with the file accessors removed.)

maybe you can take a look at activescriptruby. though i can run it only on win ie, it may help you. it needs only one or two dll. The ff html eg runs great (i just tried it).

<html>
<head>
<title>Yo-Ko-So ! Active Ruby World !</title>
<script language="RubyScript">
ActiveScriptRuby.settrace false

@ctbl = ["red", "firebrick", "deeppink", "hotpink", "lightpink",
"darksalmon", "darkorange", "coral", "crimson" ]
@ftbl = ["Times New Roman", "Modern", "Tahoma", "Arial", "Century",
"Courier New"]
@stbl = ["x-small", "small", "medium", "large", "x-large", "xx-large"]

def changeColor(s)
@window.document.all(s).style.color = @ctbl[rand(@ctbl.length)]
@window.setTimeout("changeColor(\"#{s}\")", rand(8000) + 1, "RubyScript")
end

def changeFont(s)
@window.document.all(s).style.fontFamily = @ftbl[rand(@ftbl.length)]
@window.setTimeout("changeFont(\"#{s}\")", rand(8000) + 1, "RubyScript")
end

def changeSize(s)
@window.document.all(s).style.fontSize = @stbl[rand(@stbl.length)]
@window.setTimeout("changeSize(\"#{s}\")", rand(8000) + 1, "RubyScript")
end

def changePos(s)
@window.document.all(s).style.posTop = rand(@window.screen.availHeight)
@window.document.all(s).style.posLeft = rand(@window.screen.availWidth)
@window.setTimeout("changePos(\"#{s}\")", rand(8000) + 1, "RubyScript")
end

def run()
bdy = ""
["ruby1", "ruby2", "ruby3", "ruby4", "ruby5", "ruby6", "ruby7"].each do |s|
bdy += "<SPAN ID=#{s} style='position:absolute'>Ruby</SPAN>"
@window.setTimeout("changeColor(\"#{s}\")", rand(8000) + 1, "RubyScript")
@window.setTimeout("changeFont(\"#{s}\")", rand(8000) + 1, "RubyScript")
@window.setTimeout("changeSize(\"#{s}\")", rand(8000) + 1, "RubyScript")
@window.setTimeout("changePos(\"#{s}\")", rand(8000) + 1, "RubyScript")
end
@window.document.body.innerHTML = bdy
end
</script>
</head>
<body language="RubyScript" onload="run" bgcolor="black">
</body>
</html>

kind regards -botp