forked from mntn-dev/t.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.htm
104 lines (60 loc) · 1.92 KB
/
demo.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!doctype html><html>
<head>
<title>t.js—Demo</title>
<meta charset="utf-8"/>
<meta name="author" content="Mntn® c/o Benjamin Lips"/>
<link rel="stylesheet" href="//code.cdn.mozilla.net/fonts/fira.css"/>
<style type="text/css">
<!--
::selection{background:black;color:white;}
::-webkit-selection{background:black;color:white;}
::-moz-selection{background:black;color:white;}
*{margin:0;padding:0;outline:0;border:0;font:14px/14px 'fira mono';font-weight:400;}
a{color:black;text-decoration:none;}
section{position:absolute;top:20%;left:50%;margin-left:-250px;width:500px;white-space:pre;}
strong,strong *{font-weight:600;}
del,ins{text-decoration:none;} /*unset del's default strike-trough style, plus ins' underlined*/
.t-caret{color:blue;} /*styling the caret class*/
-->
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//cdn.rawgit.com/mntn-dev/t.js/master/t.min.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
var fin=!1;
function foo(){
$('mark').eq(0).css({background:'magenta'});
}
$(function(){
$('#t').t({
speed:35,
speed_vary:true,
mistype:20,
typing:function(elem,chars_total,chars_left,_char){
if(_char=='*')foo();
},
fin:function(){
if(fin==!1){
fin=!!1; //avoids triggering after 'add' cmd
window.setTimeout(function(){$('#t').t('add','Still here?');},2e4);
window.setInterval(function(){$('#t').find('.t-caret').toggle();},5e2);
}
}
});
});
/*]]>*/
</script>
</head>
<body>
<section>
<div id="t">
<mark><a href="//mn.tn/t">t.js—Demo</a></mark>
Hello world. Let's wait <del>hundred</del>two seconds ..<ins>2</ins><br/><br/>
<strong>Thanks for waiting.</strong> Now, t.js will detect a
<del>regular</del>'special' char which triggers the function <mark>foo()</mark>.
*<ins>2</ins><ins> ← Yay, FTW!!</ins>
Good <del style="color:red;border-bottom:1px dashed red;">night</del>bye.
</div>
</section>
</body>
</html>