forked from filamentgroup/X-rayHTML
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (99 loc) · 3.73 KB
/
index.html
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
105
106
107
108
109
110
111
112
113
114
115
<!doctype html>
<!--[if lte IE 8]> <html lang="en" class="ie-lte8"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="demo/demo.css" rel="stylesheet">
<link href="dist/X-rayHTML.css" rel="stylesheet">
<link href="libs/prism.css" rel="stylesheet">
</head>
<body>
<div class="header">
<a href="http://filamentgroup.com/"><h1 id="fg-logo">Filament Group</h1></a>
</div>
<section>
<h1 class="sub">Basics</h1>
<p>By default, functionality is hooked to the <code>data-xrayhtml</code> attribute.</p>
<h2>Inline</h2>
<p>Bolting the <code>data-xrayhtml</code> attribute on without a value will give you inline code snippets, like so:</p>
<div data-xrayhtml><aside>
<blockquote>
<p>It is the unofficial force—the Baker Street irregulars.</p>
</blockquote>
<address>Sherlock Holmes</address>
<cite>Sign of Four</cite>
</aside></div>
<h2>Flip</h2>
<p>Setting “flip” as the value of the <code>data-xrayhtml</code> attribute will give you this snazzy flip-to-reveal animation (browsers without support for 3D tranforms will simply show/hide the code snippet).</p>
<div data-xrayhtml="flip"><aside>
<blockquote>
<p>It is the unofficial force—the Baker Street irregulars.</p>
</blockquote>
<address>Sherlock Holmes</address>
<cite>Sign of Four</cite>
</aside></div>
</section>
<section>
<h1 class="sub">Extras</h1>
<p>The plugin fires off a <code>create.xrayhtml</code> event that can be used to attach features like a “copy to clipboard” option (using <a href="https://github.com/jonrohan/ZeroClipboard">ZeroClipboard</a>, here) or syntax highlighting (using <a href="http://prismjs.com">Prism.js</a> here).</p>
<h2>Prism.js</h2>
<div data-xrayhtml class="prism"><aside>
<blockquote>
<p>It is the unofficial force—the Baker Street irregulars.</p>
</blockquote>
<address>Sherlock Holmes</address>
<cite>Sign of Four</cite>
</aside></div>
<h2>ZeroClipboard</h2>
<div data-xrayhtml class="zeroclip"><aside>
<blockquote>
<p>It is the unofficial force—the Baker Street irregulars.</p>
</blockquote>
<address>Sherlock Holmes</address>
<cite>Sign of Four</cite>
</aside></div>
<h2>Prism.js and ZeroClipboard</h2>
<div data-xrayhtml="flip" class="prism zeroclip"><aside>
<blockquote>
<p>It is the unofficial force—the Baker Street irregulars.</p>
</blockquote>
<address>Sherlock Holmes</address>
<cite>Sign of Four</cite>
</aside></div>
</section>
<script src="libs/jquery/jquery.js"></script>
<script src="src/X-rayHTML.js"></script>
<!-- Demo Extras! -->
<script src="libs/prism.min.js"></script>
<script src="libs/ZeroClipboard.min.js"></script>
<script type="text/javascript">
$( window ).bind( "create.xrayhtml", function( e ) {
var prism = !!~e.target.getAttribute( "class" ).indexOf( "prism" ),
zeroclip = !!~e.target.getAttribute( "class" ).indexOf( "zeroclip" ),
flash = !!( navigator.mimeTypes[ "application/x-shockwave-flash" ] || "ActiveXObject" in window );
if( prism && "Prism" in window ) {
$( ".prism" ).find( "code" ).addClass( "language-markup" );
Prism.highlightAll();
}
if( zeroclip && "ZeroClipboard" in window && flash ) {
$( e.target ).each(function() {
var copy = $( "<a/>", {
"class" : "btn btn-copy",
"href" : "#",
"text" : "Copy to Clipboard"
}),
code = $( this ).find( "code" ).text(),
clip = new ZeroClipboard( copy, {
moviePath: "libs/ZeroClipboard.swf",
text: code
});
$( this ).find( ".source-panel" ).prepend( copy );
});
}
});
</script>
</body>
</html>