Where the lonely subref, passed as a parameter of the setScript method, is the one getting converted to JavaScript, doing the whole bouncy magic.#!/usr/bin/perl use strict; use IWL::Page; use IWL::Container; use IWL::Image; use IWL::Anchor; use IWL::Break; use IWL::P2JS; my $page = IWL::Page->new->setTitle('Б Л О К & +#1040;'); my $container = IWL::Container->new(id => 'main_container', style => { +visibility => 'hidden'}); my $anchor = IWL::Anchor->new->setHref('http://code.google.com/p/iwl') +; my $logo = IWL::Image->new(id => 'logo')->set('/skin/images/logo.jpg') +; my $description = IWL::Container->new(id => 'description', inline => 1 +); my @images = ( IWL::Image->new(class => 'description', id => 'perl', src => '/ski +n/images/perl.jpg'), IWL::Image->new(class => 'description', id => 'widget', src => '/s +kin/images/widget.jpg'), IWL::Image->new(class => 'description', id => 'library', src => '/ +skin/images/library.jpg'), IWL::Image->new(class => 'description', id => 'for', src => '/skin +/images/for.jpg'), IWL::Image->new(class => 'description', id => 'the', src => '/skin +/images/the.jpg'), IWL::Image->new(class => 'description', id => 'web', src => '/skin +/images/web.jpg'), ); my ($script, $tracker) = (IWL::Script->new, IWL::Script->new); $page->appendHeader(IWL::Page::Link->newLinkToCSS('/skin/bloka.css')); $page->appendChild($container); $description->appendChild(@images); $anchor->appendChild($logo, IWL::Break->new, $description); $container->appendChild($anchor, $tracker, $script); $script->setScript(sub { my $path = '/skin/images/'; $container->setStyle(visibility => 'visible', display => 'none'); $container->positionAtCenter->appear({duration => 4}); foreach (['perl', 61], ['widget', 66], ['library', 69], ['for', 44 +], ['the', 34], ['web', 52]) { S($_->[0])->signalConnect(mouseover => (sub { my ($args) = @_; $this->{downEffect}->cancel if $this->{downEffect}; $this->{upEffect} = Effect::Morph->new($this, {style => {w +idth => $args->[1] * 2 . 'px', height =>'74px'}, duration => 0.2, bef +oreStart => $this->{writeAttribute}->bind($this, {src => "${path}$arg +s->[0]2.jpg"})}) })->bind(S($_->[0]), $_))->signalConnect(mouseout => (sub { my ($args) = @_; $this->{upEffect}->cancel if $this->{upEffect}; $this->{downEffect} = Effect::Morph->new($this, {style => +{width => $args->[1] . 'px', height => '37px'}, duration => 0.2, afte +rFinish => $this->{writeAttribute}->bind($this, {src => "${path}$args +->[0].jpg"})}) })->bind(S($_->[0]), $_)); } my $pageTracker = _gat::_getTracker('UA-2846284-2'); $pageTracker->_initData; $pageTracker->_trackPageview; }); $tracker->setSrc('http://www.google-analytics.com/ga.js'); $page->send(type => 'html', static => 1);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Translating Perl into JavaScript
by dragonchild (Archbishop) on Jun 02, 2008 at 17:04 UTC | |
by stvn (Monsignor) on Jun 02, 2008 at 21:27 UTC | |
|
Re: Translating Perl into JavaScript
by moritz (Cardinal) on Jun 02, 2008 at 15:53 UTC | |
by /dev/urandom (Beadle) on Jun 02, 2008 at 17:55 UTC | |
by Jarble (Initiate) on Mar 15, 2017 at 18:56 UTC | |
by LanX (Saint) on Mar 15, 2017 at 19:55 UTC |