Created
February 28, 2012 10:27
-
-
Save aanoaa/1931768 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html><html> | |
<head> | |
<title> | |
Mojolicious - Perl real-time web framework | |
</title> | |
<link href="/css/prettify-mojo.css" media="screen" rel="stylesheet" type="text/css" /> | |
<script src="/js/prettify.js" type="text/javascript"></script> | |
<style type="text/css">/*<![CDATA[*/ | |
a { color: inherit } | |
a:hover { color: #2a2a2a } | |
a img { border: 0 } | |
body { | |
background-color: #f5f6f8; | |
color: #445555; | |
font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; | |
font-weight: normal; | |
line-height: 1.5; | |
margin: 0; | |
} | |
pre { | |
background: url(/mojolicious-pinstripe.gif); | |
-moz-border-radius: 5px; | |
border-radius: 5px; | |
color: #eee; | |
font: 0.8em Consolas, Menlo, Monaco, Courier, monospace; | |
text-align: left; | |
text-shadow: #333 0 1px 0; | |
padding-bottom: 1.5em; | |
padding-top: 1.5em; | |
white-space: pre-wrap; | |
} | |
#footer { | |
margin-top: 1.5em; | |
text-align: center; | |
width: 100%; | |
} | |
/*]]>*/</style> | |
<link href="/css/index.css" media="screen" rel="stylesheet" type="text/css" /> | |
<script type="text/javascript">//<![CDATA[ | |
var gaJsHost = | |
(("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | |
document.write(unescape( | |
"%3Cscript src='" | |
+ gaJsHost | |
+ "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E" | |
)); | |
//]]></script><script type="text/javascript">//<![CDATA[ | |
try { | |
var pageTracker = _gat._getTracker("UA-7866593-1"); | |
pageTracker._trackPageview(); | |
} catch(err) {} | |
//]]></script> | |
</head> | |
<body onload="prettyPrint()"><a href="http://github.com/kraih/mojo"> | |
<img style="position: absolute; top: 0; right: 0; border: 0;" | |
src="https://a248.e.akamai.net/assets.github.com/img/7afbc8b248c68eb468279e8c17986ad46549fb71/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" | |
alt="Fork me on GitHub"> | |
</a> | |
<div id="fun"> | |
<a href="http://latest.mojolicio.us"> | |
<img src="/unicorn.png" /> | |
</a></div> | |
<script src="/js/jquery.js" type="text/javascript"></script> | |
<div id="mojobar"> | |
<style scoped="scoped" type="text/css">/*<![CDATA[*/ | |
#mojobar { | |
background-color: #1a1a1a; | |
background: -webkit-gradient( | |
linear, | |
0% 0%, | |
0% 100%, | |
color-stop(0%, #2a2a2a), | |
color-stop(100%, #000) | |
); | |
background: -moz-linear-gradient( | |
top, | |
#2a2a2a 0%, | |
#000 100% | |
); | |
background: linear-gradient(top, #2a2a2a 0%, #000 100%); | |
-moz-box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.6); | |
-webkit-box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.6); | |
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.6); | |
height: 60px; | |
overflow: hidden; | |
position: absolute; | |
text-align: right; | |
vertical-align: middle; | |
width: 100%; | |
z-index: 1000; | |
} | |
#mojobar-logo { | |
float: left; | |
margin-left: 5em; | |
padding-top: 2px; | |
} | |
#mojobar-links { | |
display:table-cell; | |
float: right; | |
height: 60px; | |
margin-right: 5em; | |
margin-top: 1.5em; | |
} | |
#mojobar-links a { | |
color: #ccc; | |
font: 1em 'Helvetica Neue', Helvetica, sans-serif; | |
font-weight: 300; | |
margin-left: 0.5em; | |
padding-bottom: 1em; | |
padding-top: 1em; | |
text-decoration: none; | |
-webkit-transition: all 200ms ease-in-out; | |
-moz-transition: all 200ms ease-in-out; | |
-o-transition: all 200ms ease-in-out; | |
transition: all 200ms ease-in-out; | |
} | |
#mojobar-links a:hover { color: #fff } | |
/*]]>*/</style> <div id="mojobar-logo"> | |
<a href="http://mojolicio.us"> | |
<img alt="Mojolicious logo" src="/mojolicious-white.png" /> | |
</a> </div> | |
<div id="mojobar-links"> | |
<a href="http://mojolicio.us/perldoc">Documentation</a> | |
<a href="http://mojocasts.com">Screencasts</a> | |
<a href="https://github.com/kraih/mojo/wiki">Wiki</a> | |
<a href="https://github.com/kraih/mojo">GitHub</a> | |
<a href="http://metacpan.org/release/Mojolicious/">CPAN</a> | |
<a href="http://groups.google.com/group/mojolicious">MailingList</a> | |
<a href="http://blog.kraih.com">Blog</a> | |
<a href="http://twitter.com/kraih">Twitter</a> | |
</div> | |
</div> | |
<script type="text/javascript">//<![CDATA[ | |
$(window).load(function () { | |
var mojobar = $('#mojobar'); | |
var start = mojobar.offset().top; | |
var fixed; | |
$(window).scroll(function () { | |
if (!fixed && (mojobar.offset().top - $(window).scrollTop() < 0)) { | |
mojobar.css('top', 0); | |
mojobar.css('position', 'fixed'); | |
fixed = true; | |
} else if (fixed && $(window).scrollTop() <= start) { | |
mojobar.css('position', 'absolute'); | |
mojobar.css('top', start + 'px'); | |
fixed = false; | |
} | |
}); | |
}); | |
$(document).ready(function(){ | |
$(".mojoscroll").click(function(e){ | |
e.preventDefault(); | |
e.stopPropagation(); | |
var parts = this.href.split("#"); | |
var hash = "#" + parts[1]; | |
var target = $(hash); | |
var top = target.offset().top - 70; | |
var old = target.attr('id'); | |
target.attr('id', ''); | |
location.hash = hash; | |
target.attr('id', old); | |
$('html, body').animate({scrollTop:top}, 500); | |
}); | |
}); | |
//]]></script> | |
<div id="wrapperlicious"> | |
<div id="introduction"> | |
<h1> | |
A next generation web framework for the Perl programming language. | |
</h1> | |
<p> | |
Back in the early days of the web, many people learned Perl because of | |
a wonderful Perl library called | |
<a href="http://metacpan.org/module/CGI">CGI</a>. | |
It was simple enough to get started without knowing much about the | |
language and powerful enough to keep you going, learning by doing was | |
much fun. | |
While most of the techniques used are outdated now, the idea behind it | |
is not. | |
<a href="perldoc/Mojolicious">Mojolicious</a> is a new attempt at | |
implementing this idea using state of the art technology. | |
</p> | |
<h2>Features</h2> | |
<ul> | |
<li> | |
An amazing real-time web framework supporting a simplified single | |
file mode through | |
<a href="perldoc/Mojolicious/Lite">Mojolicious::Lite</a>. | |
<blockquote> | |
<p> | |
Powerful out of the box with RESTful routes, plugins, | |
Perl-ish templates, session management, signed cookies, | |
testing framework, static file server, I18N, first class | |
unicode support and much more for you to discover. | |
</p> | |
</blockquote> | |
</li> | |
<li> | |
Very clean, portable and Object Oriented pure Perl API without any | |
hidden magic and no requirements besides Perl 5.10.1 (although 5.12+ | |
is recommended, and optional CPAN modules will be used to provide | |
advanced functionality if they are installed). | |
</li> | |
<li> | |
Full stack HTTP 1.1 and WebSocket client/server implementation with | |
IPv6, TLS, Bonjour, IDNA, Comet (long polling), chunking and | |
multipart support. | |
</li> | |
<li> | |
Built-in non-blocking I/O web server supporting | |
<a href="http://libev.schmorp.de">libev</a> and hot deployment, | |
perfect for embedding. | |
</li> | |
<li> | |
Automatic CGI and <a href="http://plackperl.org">PSGI</a> detection. | |
</li> | |
<li>JSON and HTML5/XML parser with CSS3 selector support.</li> | |
<li> | |
Fresh code based upon years of experience developing | |
<a href="http://catalystframework.org">Catalyst</a>. | |
</li> | |
</ul> | |
<h2>Installation</h2> | |
<p>All you need is a oneliner, it takes less than a minute.</p> | |
<pre> $ sudo sh -c "curl -L cpanmin.us | perl - Mojolicious"</pre> | |
<h2>Getting Started</h2> | |
<p>These three lines are a whole web application.</p> | |
<pre class="prettyprint"> use Mojolicious::Lite; | |
get '/' => {text => 'Hello World!'}; | |
app->start;</pre> | |
<p> | |
To run this example with the built-in development web server just put | |
the code into a file and start it with "morbo". | |
</p> | |
<pre> $ morbo hello.pl | |
Server available at http://127.0.0.1:3000. | |
$ curl http://127.0.0.1:3000/ | |
Hello World!</pre> | |
<h2>Duct tape for the HTML5 web</h2> | |
<p> | |
Web development for humans, making hard things possible and everything | |
fun. | |
</p> | |
<pre class="prettyprint"> use Mojolicious::Lite; | |
# Simple plain text response | |
get '/' => {text => 'Hello World!'}; | |
# Route associating "/time" with template in DATA section | |
get '/time' => 'clock'; | |
# RESTful web service with JSON and text representation | |
get '/list/:offset' => sub { | |
my $self = shift; | |
my $numbers = [0 .. $self->param('offset')]; | |
$self->respond_to( | |
json => {json => $numbers}, | |
txt => {text => join(',', @$numbers)} | |
); | |
}; | |
# Scrape information from remote sites | |
post '/title' => sub { | |
my $self = shift; | |
my $url = $self->param('url') || 'http://mojolicio.us'; | |
$self->render_text( | |
$self->ua->get($url)->res->dom->html->head->title->text); | |
}; | |
# WebSocket echo service | |
websocket '/echo' => sub { | |
my $self = shift; | |
$self->on(message => sub { | |
my ($self, $message) = @_; | |
$self->send("echo: $message"); | |
}); | |
}; | |
app->start; | |
__DATA__ | |
@@ clock.html.ep | |
% use Time::Piece; | |
% my $now = localtime; | |
The time is <%= $now->hms %>.</pre> | |
<p> | |
Single file prototypes like this one can easily grow into | |
well-structured applications. | |
</p> | |
<h1>Want to know more?</h1> | |
<p> | |
Take a look at our excellent | |
<a href="http://mojolicio.us/perldoc">documentation</a>! | |
</p> | |
</div> | |
</div> | |
<div id="footer"> | |
<a href="http://mojolicio.us"> | |
<img alt="Mojolicious logo" src="/mojolicious-black.png" /> | |
</a></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
jquery waypoint 없이 특정영역에서 header 를 고정시킨게 인상적