[addon linkify] Set up proper initialization of add-on

- Also created a demo page for the addon
This commit is contained in:
paris 2015-01-04 15:45:26 +02:00
parent b60903a2ae
commit 523ff9908f
2 changed files with 47 additions and 0 deletions

36
addons/linkify/index.html Normal file
View File

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="../../src/xterm.css" />
<link rel="stylesheet" href="../../demo/style.css" />
<script src="../../src/xterm.js"></script>
<script src="linkify.js"></script>
<style>
body {
color: #111;
}
#terminal-container {
max-width: 900px;
margin: 0 auto;
}
#terminal-container a {
color: #fff;
}
</style>
</head>
<body>
<div id="terminal-container"></div>
<script>
var term = new Terminal(),
container = document.getElementById('terminal-container');
term.open(container);
term.writeln('Hello, welcome to xterm.js');
term.writeln('');
term.writeln('Check it out at github.com/sourcelair/xterm.js');
term.linkify();
</script>
</body>
</html>

View File

@ -1,4 +1,15 @@
(function (linkify) { (function (linkify) {
if (typeof define == 'function') {
/*
* Require.js is available
*/
define(['../../src/xterm'], linkify);
} else {
/*
* Plain browser environment
*/
linkify(this.Xterm);
}
})(function (Xterm) { })(function (Xterm) {
Xterm.prototype.linkify = function () { Xterm.prototype.linkify = function () {
var rows = this.rowContainer.children, var rows = this.rowContainer.children,