This repository has been archived by the owner on Jan 21, 2018. It is now read-only.
/
index.html
146 lines (118 loc) · 3.94 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html>
<head>
<title>fiddleHubJS</title>
<style>
a {
color: #FFFFFF;
}
body {
font-family: arial, sans-serif;
color: #FFFFFF;
background: #3D668F;
}
html, body {
top:0px;
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
overflow: hidden;
}
#jsFiddleFrame {
width: 100%;
margin: 0px;
padding: 0px;
border: 0px solid black;
}
#controls {
top: 0px;
display: inline;
padding: 0px 0px 0px 5px;
margin: 0px;
line-height: 23px;
}
#indicator {
display: none;
}
#originalLink {
cursor: pointer;
text-decoration: none;
border-bottom: 1px solid;
}
#aboutLink {
cursor: pointer;
text-decoration: none;
border-bottom: 1px dotted;
}
#about {
width: 700px;
padding: 10px;
position: absolute;
background: #567FA8;
overflow-y: scroll;
border: 0px solid #FFFFFF;
display: none;
}
</style>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js'></script>
<script src='http://documentcloud.github.com/underscore/underscore-min.js'></script>
<script src='http://documentcloud.github.com/backbone/backbone-min.js'></script>
<script src='base64.js'></script>
<script src='URI.js'></script>
<script src='fiddleHub.js'></script>
<script>
$(function () {
var about = $('#about'),
aboutLink = $('#aboutLink'),
frame = $('#jsFiddleFrame');
function resize() {
frame.height($(window).height() - frame.offset().top);
about.height($(window).height() - about.offset().top);
}
function checkHash() {
(window.location.hash == '' || window.location.hash == '#') ? about.show() : about.hide();
};
aboutLink.click(function() {
about.is(':hidden') ? about.show() : about.hide();
});
resize();
checkHash();
$(window).bind('hashchange', checkHash);
$(window).resize(resize);
});
</script>
</head>
<body>
<div id='controls'>
fiddleHubJS
<select id='files'></select>
<a id='originalLink' target='_blank' title='Open original Github file in new tab'>Original</a>
<a id='aboutLink'>About</a>
<img id='indicator' src='loader.gif'>
</div>
<div id='about'>
<p>fiddleHubJS is a small utility to quickly demonstrate your javascript stuff from <a href='http://github.com'>GitHub</a> in <a href='http://jsfiddle.net' target='_blank'>jsFiddle</a>.</p>
<p>If it's a <code>.html</code> file, everything in <code><script src='…'></script></code> will go into fiddle dependencies, body and inline script tags in HTML and JavaScript windows accordingly. Files with "js" extension will load up to javascript window untouched.</p>
It works by using <a href='http://developer.github.com/v3/' target='_blank'>GitHub API v3</a> and <a href='http://doc.jsfiddle.net/api/post.html' target='_blank'>jsFiddle POST API</a>.
<h1>Usage</h1>
<p>Just add github file or repo url after the hash.</p>
<ul>
<li><a href='#https://github.com/agentcooper/Euler-JS/blob/master/avva1567/index.html'>#https://github.com/agentcooper/Euler-JS/blob/master/avva1567/index.html</a></li>
<li><a href='#https://github.com/agentcooper/Euler-JS'>#https://github.com/agentcooper/Euler-JS</a> (repo link)</li>
<li><a href='#https://github.com/mrdoob/three.js/blob/master/examples/canvas_geometry_text.html'>#https://github.com/mrdoob/three.js/blob/master/examples/canvas_geometry_text.html</a> (works after setting <i>No-Wrap (body)</i> and running again)</li>
</ul>
<h1>Why?</h1>
<p>Well, I was doing some problems at <a href='http://projecteuler.net/'>Project Euler</a>, using repo at github, and wanted to show them using jsFiddle. Now I can, check them out! :-)</p>
<h1>Known bugs:</h1>
<ul>
<li>Some scripts require body tag, so you need to manually switch to <i>No-Wrap (body)</i>, and press <i>Run</i> again.</li>
</ul>
<h1>Links</h1>
<ul>
<li><a href='https://github.com/agentcooper/fiddleHubJS' target='_blank'>fiddleHubJS @ GitHub</a></li>
</ul>
</div>
<iframe name="fiddleFrame" id='jsFiddleFrame'></iframe>
</body>
</html>