Skip to content

Commit 1e9460f

Browse files
committed
updated promo & moved to node-websocket-server
1 parent 1d3d903 commit 1e9460f

File tree

3 files changed

+43
-14
lines changed

3 files changed

+43
-14
lines changed

index.php

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function support($support) {
1919
$class .= ' none';
2020
}
2121

22-
$html .= '<span title="' . trim($class) . '" class="' . $browser . $class . '">' . $browser . ':' . $class . '</span> ';
22+
$html .= '<span title="' . trim($class) . '" class="tag ' . $browser . $class . '">' . $browser . ':' . $class . '</span> ';
2323
}
2424

2525
return $html;
@@ -29,7 +29,7 @@ function spans($list) {
2929
$items = split(' ', $list);
3030
$html = '';
3131
foreach ($items as $item) {
32-
$html .= '<span>' . $item . '</span> ';
32+
$html .= '<span class="tag">' . $item . '</span> ';
3333
}
3434

3535
return $html;
@@ -52,17 +52,20 @@ function spans($list) {
5252
<article>
5353
<p><abbr>HTML</abbr> 5 experimentation and demos I've hacked together. Click on the browser support icon or the technology tag to filter the demos (the filter is an <code>OR</code> filter).</p>
5454
<section>
55-
<a href="http://full-frontal.org" id="ffad" title="JavaScript Conference: Full Frontal, 12th November">
56-
<img src="http://2010.full-frontal.org/images/ff2010.png" alt="Full Frontal Logo" />
57-
<p><strong>Learn more HTML5 &amp; JavaScript:</strong> Full Frontal is a conference, <em>run by</em> front end developers <em>for</em> front end developers, held in the UK on 12th November.</p>
58-
<p>Early bird tickets start at £100. Find out more: <em class="url">http://full-frontal.org</em></p>
55+
<a href="http://introducinghtml5.com" id="ih5">
56+
<p><strong>Introducing HTML5</strong> by Bruce Laweson &amp; Remy Sharp is the first full length book dedicated to HTML5.</p><p>Get it now and kick some HTML5 ass!</p>
5957
</a>
6058
</section>
59+
<p id="tags" class="tags">
60+
61+
</p>
6162
<table id="demos">
6263
<thead>
63-
<th>Demo</th>
64-
<th>Support</th>
65-
<th>Technology</th>
64+
<tr>
65+
<th>Demo</th>
66+
<th>Support</th>
67+
<th>Technology</th>
68+
</tr>
6669
</thead>
6770
<tbody>
6871
<?php foreach ($demos as $demo) :?>
@@ -82,8 +85,9 @@ function spans($list) {
8285

8386
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
8487
<script>
85-
$('tbody tr span').click(function () {
86-
var $tag = $(this), tag = $tag.text(), type = $tag.closest('td').attr('class');
88+
$(document).delegate('span.tag', 'click', function () {
89+
var $tag = $(this), tag = $tag.text(), type = $tag.closest('td').attr('class') || 'tags';
90+
8791
if ($tag.is('.selected')) {
8892
$('.' + type + ' span:contains(' + tag + ')').removeClass('selected');
8993
} else {
@@ -97,9 +101,21 @@ function spans($list) {
97101
$trs.show();
98102
} else {
99103
$('tbody tr').show();
104+
}
105+
});
106+
107+
var html = [];
108+
$('.tags span.tag').each(function () {
109+
var $tag = $(this), tag = $tag.text();
110+
111+
if (!tags[tag]) {
112+
tags[tag] = true;
113+
html.push('<span class="tag">' + tag + '</span> ');
100114
}
101115
});
102116

117+
$('#tags').append('<strong>Filter demos:</strong> ' + html.sort().join(''));
118+
103119
// $('tr td.demo').click(function () {
104120
// window.location = $(this).find('a').attr('href');
105121
// });

js/h5utils.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,21 @@ addEvent(window, 'click', function (event) {
3535
if (event.target.hash == '#view-source') {
3636
// event.preventDefault();
3737
if (!document.getElementById('view-source')) {
38-
pre.innerHTML = ('<!DOCTYPE html>\n<html>\n' + document.documentElement.innerHTML + '\n</html>').replace(/[<>]/g, function (m) { return {'<':'&lt;','>':'&gt;'}[m]});
39-
document.body.appendChild(pre);
38+
// pre.innerHTML = ('<!DOCTYPE html>\n<html>\n' + document.documentElement.innerHTML + '\n</html>').replace(/[<>]/g, function (m) { return {'<':'&lt;','>':'&gt;'}[m]});
39+
var xhr = new XMLHttpRequest();
40+
41+
// original source - rather than rendered source
42+
xhr.onreadystatechange = function () {
43+
if (this.readyState == 4 && this.status == 200) {
44+
pre.innerHTML = this.responseText.replace(/[<>]/g, function (m) { return {'<':'&lt;','>':'&gt;'}[m]});
45+
prettyPrint();
46+
}
47+
};
48+
49+
document.body.appendChild(pre);
50+
// really need to be sync? - I like to think so
51+
xhr.open("GET", window.location, true);
52+
xhr.send();
4053
}
4154
document.body.className = 'view-source';
4255

server/custom-echo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var sys = require("sys")
44
, fs = require("fs")
55
, path = require("path")
66
, http = require("http")
7-
, ws = require('../lib/ws');
7+
, ws = require(__dirname + '/node-websocket-server/lib/ws');
88

99
/*-----------------------------------------------
1010
logging:

0 commit comments

Comments
 (0)