This file contains 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
G.add('js/util/event/event_emitter.js', [], function (require, exports, module) { | |
// Events | |
// ----------------- | |
// Thanks to: | |
// - https://github.com/documentcloud/backbone/blob/master/backbone.js | |
// - https://github.com/joyent/node/blob/master/lib/events.js | |
// Regular expression used to split event strings | |
var eventSplitter = /\s+/ |
This file contains 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
/* | |
如果传来的参数为html集合,则只取第一个节点进行操作 | |
*/ | |
var attr = function(elem, name, value) { | |
if (!elem) | |
return ; | |
if (elem.length > 1) { | |
elem = elem[0]; | |
} |
This file contains 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
/* | |
document.getElementById(); | |
document.getElementsByTagName(); | |
document.getElementsByName(); | |
以上三种方法在主流浏览器中得到原生支持,但是通过class取得元素以及通过css选择器的方式取得元素,即 | |
getElementsByClassName与querySelectorAll未在IE6、7、8中得到完全支持 | |
*/ |
This file contains 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 lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Chat Demo</title> | |
<style type="text/css"> | |
form { | |
width: 600px; | |
margin: 0 auto; | |
} |
This file contains 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 lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script src="/socket.io/socket.io.js"></script> | |
<script type="text/javascript"> | |
window.onload = function() { | |
var socketIo = io.connect('http://localhost'); | |
socketIo.on('connection', function(data) { |
This file contains 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 lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script type="text/javascript"> | |
window.onload = function() { | |
var socket = new WebSocket("ws://" + location.host + "/"); | |
socket.onmessage = function(event) { |
This file contains 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
<?php | |
class DBCxn{ | |
public static $dsn = 'mysql:host=localhost;dbname=webrss'; | |
public static $user = 'root'; | |
public static $pass = 'root'; | |
//保存连接的内部变量 | |
private static $db; | |
//不能克隆和技巧化 | |
final private function __construct(){} | |
final private function __clone(){} |