-
Notifications
You must be signed in to change notification settings - Fork 25
/
index.html
570 lines (489 loc) · 20.7 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1"/>
<meta name="description" content="Browser Ponies lets you place ponies on websites"/>
<title>Browser Ponies</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
<link rel="stylesheet" type="text/css" href="gui.css"/>
<link rel="stylesheet" type="text/css" href="https://panzi.github.io/SocialSharePrivacy/stylesheets/jquery.socialshareprivacy.min.css"/>
<!--[if IE]>
<script type="text/javascript" src="https://stringencoders.googlecode.com/svn-history/r230/trunk/javascript/base64.js"></script>
<script type="text/javascript">
if (!window.btoa) window.btoa = base64.encode;
if (!window.atob) window.atob = base64.decodeo;
</script>
<![endif]-->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>
<script type="text/javascript" src="jquery.cookies.js"></script>
<script type="text/javascript" src="https://panzi.github.io/SocialSharePrivacy/javascripts/jquery.socialshareprivacy.min.js"></script>
<script type="text/javascript" src="ponycfg.js" id="browser-ponies-config"></script>
<script type="text/javascript" src="browserponies.js" id="browser-ponies-script"></script>
<script type="text/javascript" src="gui-common.js"></script>
<script type="text/javascript" src="gui.js"></script>
<script type="text/javascript">
// <![CDATA[
var disqus_shortname = 'browserponies';
jQuery(document).ready(function ($) {
$('#share').socialSharePrivacy({
order: ['twitter','tumblr','disqus','reddit','stumbleupon','linkedin','mail','gplus','pinterest','facebook'],
layout: 'box',
services: {
tumblr: {type: 'video'},
twitter: {tweet_text: $.fn.socialSharePrivacy.getDescription},
flattr: {status: false},
disqus: {
shortname: disqus_shortname,
onclick: function () {
$('#comments-button').click();
}
}
},
image: absUrl('ponies/rainbow%20dash/hoverupdown_rainbow_right.gif'),
embed: function () { return iframeEmbedCode({
baseurl: absUrl(''),
autostart: true,
spawn: BrowserPoniesConfig.spawn
});
},
path_prefix: "https://panzi.github.io/SocialSharePrivacy/"
});
$('#comments-button').click(function () {
$.getScript('https://' + disqus_shortname + '.disqus.com/embed.js');
$(this).remove();
});
});
// ]]>
</script>
</head>
<body onload="init();updateConfig();initScriptUrl();">
<div id="main">
<h1>Browser Ponies</h1>
<p id="controls">
<a class="button" href="javascript:BrowserPonies.start();void(0)" title="Start">▶</a>
<a class="button" href="javascript:BrowserPonies.stop();void(0)" title="Stop">■</a>
<a class="button" href="javascript:BrowserPonies.pause();void(0)" title="Pause">▮▮</a>
<a class="button" href="javascript:BrowserPonies.resume();void(0)" title="Resume">▮▶</a>
<a class="button" href="javascript:BrowserPonies.togglePoniesToBackground();void(0)"
title="Toggle ponies in background">↕</a>
<a class="button" href="javascript:BrowserPonies.unspawnAll();BrowserPonies.stop();void(0)" title="Remove all Ponies">×</a>
</p>
<div id="share"></div>
<h2>What is this?</h2>
<p>
Browser Ponies lets you place <a href="http://en.wikipedia.org/wiki/My_Little_Pony:_Friendship_Is_Magic">ponies</a>
on websites (see the ponies here). You can create a bookmarklet which adds your favourite ponies to any website.
</p>
<p>
This is a reimplementation of <a href="https://github.com/RoosterDragon/Desktop-Ponies">Desktop Ponies</a> in JavaScript.
It doesn't behave exactly like the original but is close enough (no games and no cursor avoidance etc.).
</p>
<p>
Browser Ponies work best with <a href="https://www.google.com/chrome/browser/">Google Chrome</a>, but they also
work okay in <a href="https://www.mozilla.org/firefox/">Mozilla Firefox</a>.
</p>
<p>
The artwork used is from the <a href="http://www.ponychan.net/chan/collab/res/43172.html">Ponychan fork</a> of
<a href="http://sourceforge.net/projects/desktopponies/">Desktop Ponies</a>, <cite>My Little Pony: Friendship Is
Magic</cite> is © by <a href="http://www.hubworld.com/my-little-pony/shows/friendship-is-magic">Hasbro</a> and
<a href="http://fyre-flye.deviantart.com/">Lauren Faust</a>.
</p>
<h2>Short URL</h2>
<p>
You can put ponies on a website by simply putting <tt>"http://tinyurl.com/ponyfy#"</tt> in front
of the URL of the website. So e.g. <tt>"<a href="http://example.com/">example.com</a>"</tt> becomes
<tt>"<a href="http://tinyurl.com/ponyfy#example.com">http://tinyurl.com/ponyfy#example.com</a>"</tt>.
</p>
<p>
Note that not all websites allow embedding in an iframe (which is used here). E.g.
<a href="http://tinyurl.com/ponyfy#google.com">Google does not work</a>.
</p>
<h2>Make a Bookmarklet</h2>
<p>Choose your ponies belown and then drag this link into your Bookmark Toolbar:</p>
<p id="bookmarkletwrapper">
<a class="button" href="javascript:void(0)" id="bookmarklet">Ponies!</a>
</p>
<p>Click it whenever you feel a website needs more ponies.</p>
<p>
You can also bookmark the control links above in order to have control over ponies on any website.
However, the <cite><a href="#toggleinbg">Toggle ponies in background</a></cite> function needs special
support by the website in order to work.
</p>
<p>
<label for="embedcode">Or paste this into your webpage:</label>
<div id="embedcodewrap"><textarea id="embedcode" onclick="this.select();"></textarea></div>
</p>
<p>
<label for="iframe">Or if you don't want to include my script directly in your webpage
you can use this embed code to confine the ponies into an iframe:</label>
</p>
<table>
<tbody>
<tr>
<td><input type="checkbox" id="paddock" onchange="updateConfig();" checked/></td>
<td><label for="paddock">Show Paddock</label></td>
</tr>
<tr>
<td><input type="checkbox" id="grass" onchange="updateConfig();" checked/></td>
<td><label for="grass">Show Grass</label></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><label for="iframe-width">Width:</label></td>
<td>
<input type="text" class="number" id="iframe-width" value="640" data-value="640"
data-min="10" data-decimals="0" data-step="10" size="3"
onchange="numberFieldChanged.call(this,event);"/>
</td>
<td>px</td>
<td>
<button onclick="increaseNumberField.call($('iframe-width'));">+</button>
<button onclick="decreaseNumberField.call($('iframe-width'));">–</button>
</td>
</tr>
<tr>
<td><label for="iframe-height">Height:</label></td>
<td>
<input type="text" class="number" id="iframe-height" value="480" data-value="480"
data-min="10" data-decimals="0" data-step="10" size="3"
onchange="numberFieldChanged.call(this,event);"/>
</td>
<td>px</td>
<td>
<button onclick="increaseNumberField.call($('iframe-height'));">+</button>
<button onclick="decreaseNumberField.call($('iframe-height'));">–</button>
</td>
</tr>
</tbody>
</table>
<p>
<div id="iframewrap"><textarea id="iframe" onclick="this.select();"></textarea></div>
</p>
<h3>Change settings and choose your ponies</h3>
<table>
<tbody>
<tr>
<td><input type="checkbox" id="enableaudio" onchange="updateConfig();"/></td>
<td><label for="enableaudio">Enable Audio</label>
<span id="noaudio">(Your Browser does not support HTML5 Audio. Get a
<a href="https://www.google.com/chrome/browser/" title="Goolge Chrome or…">better</a>
<a href="https://www.mozilla.org/firefox/" title="…Mozilla Firefox">browser</a>.)</span>
<span id="hasaudio" style="display:none;">(Your browser supports HTML 5 Audio.)</span>
</td>
</tr>
<tr>
<td><input type="checkbox" id="showfps" onchange="updateConfig();"/></td>
<td><label for="showfps">Show Frames per Second</label></td>
</tr>
<tr>
<td><input type="checkbox" id="progressbar" onchange="updateConfig();" checked/></td>
<td><label for="progressbar">Show Progress Bar</label></td>
</tr>
<tr>
<td><input type="checkbox" id="dontspeak" onchange="updateDontSpeak(this.checked);"/></td>
<td><label for="dontspeak">Never Speak</label></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><label for="speed">Speed Multiplier:</label></td>
<td>
<input type="text" class="number" id="speed" value="3.0" data-value="3.0"
data-min="0.1" data-decimals="1" data-step="0.1" size="3"
onchange="numberFieldChanged.call(this,event);"/>
</td>
<td></td>
<td>
<button onclick="increaseNumberField.call($('speed'));">+</button>
<button onclick="decreaseNumberField.call($('speed'));">–</button>
</td>
</tr>
<tr title="Even if this is 0% ponies will speak if an animation requires it.">
<td><label for="speak">Random Speak Probability:</label></td>
<td>
<input type="text" class="number" id="speak" value="15"
data-value="15" data-min="0" data-max="100" data-decimals="0" size="3"
onchange="numberFieldChanged.call(this,event);"/>
</td>
<td>%</td>
<td>
<button onclick="increaseNumberField.call($('speak'));">+</button>
<button onclick="decreaseNumberField.call($('speak'));">–</button>
</td>
</tr>
<tr>
<td><label for="volume">Volume:</label></td>
<td>
<input type="text" class="number" id="volume" value="100" data-value="100"
data-min="0" data-max="100" data-decimals="0" data-step="10" size="3"
onchange="numberFieldChanged.call(this,event);"/>
</td>
<td>%</td>
<td>
<button onclick="increaseNumberField.call($('volume'));">+</button>
<button onclick="decreaseNumberField.call($('volume'));">–</button>
</td>
</tr>
<tr>
<td><label for="fps">Frames per Second:</label></td>
<td>
<input type="text" class="number" id="fps" value="25"
data-value="25" data-min="1" data-decimals="0" size="3"
onchange="numberFieldChanged.call(this,event);"/>
</td>
<td></td>
<td>
<button onclick="increaseNumberField.call($('fps'));">+</button>
<button onclick="decreaseNumberField.call($('fps'));">–</button>
</td>
</tr>
<tr>
<td><label for="fade">Fade Duration:</label></td>
<td>
<input type="text" class="number" id="fade" value="0.5"
data-value="0.5" data-min="0" data-decimals="1" data-step="0.1" size="3"
onchange="numberFieldChanged.call(this,event);"/>
</td>
<td>sec</td>
<td>
<button onclick="increaseNumberField.call($('fade'));">+</button>
<button onclick="decreaseNumberField.call($('fade'));">–</button>
</td>
</tr>
</tbody>
</table>
<div id="filterwrapper">
<label for="addcat">Filter Categories:</label>
<button id="addcat" onclick="showCategorySelect();">+</button>
<ul id="catselect" style="display:none;">
<li id="allcatsadded">All Added</li>
</ul>
<ul id="catlist"></ul>
<span id="nocatadded" style="display:none;">No Category Selected</span>
<button onclick="removeAllCategories();" title="Remove All">⌫</button>
</div>
<ul id="ponylist"></ul>
<p id="zero"><button onclick="setAllZero();">Set all Ponies to 0</button></p>
<h3>Bookmarks Menu</h3>
<p>
If you'd like you can download a bookmarks file with links to add a certain pony
and the controls from the top of this page. Just right click-save this link and
import the resulting file in your browser (only tested in Chrome and Firefox):
</p>
<p id="bookmarkswrapper">
<a class="button" href="javascript:void(0)" id="bookmarks">Bookmarks Menu</a>
</p>
<h3>Feedback</h3>
<p>
Send me feedback via <a id="email">email</a>, write a <a href="#disqus_thread">comment</a>,
<a href="https://www.twitter.com/bloodyalbatross">tweet me</a> or write a
<a href="https://github.com/panzi/Browser-Ponies/issues/new">bug report</a>.
</p>
<script type="text/javascript">
// <!--
$('email').href = 'znvygb:[email protected]'.replace(/[a-z]/ig, function(c){
return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);
});
// -->
</script>
<h2>Advanced User Stuff</h2>
<h3>Browser Support</h3>
<p>
Firefox has a bug concerning the animation speed of animated GIFs (I tried to work around this by
shortening all effect durations when using Firefox). Also I found no way to control the animation
playback of individual images in Firefox, which sometimes causes animation errors (when a effect
is shown twice both effect animations are synchronized).
</p>
<p>
In Internet Explorer I managed to control GIF animation playback using iframes, but you can't make
them transparent and border less. In Chrome iframes do not suffer from this limitation.
</p>
<h3 id="toggleinbg">Toggle ponies in background</h3>
<p>
In order to support the <cite>Toggle ponies in background</cite> function websites need
to define a special function called <tt>toggleBrowserPoniesToBackground</tt>. This function
changes the z-index of everything that should appear in front of the ponies. The ponies have
a z-index of <tt>9000000 + distance from top window border to bottom of the pony</tt>. The
speak bubbles have a z-index of <tt>9009000</tt> (I assumed noone has a screen higher than
9000 pixels).
</p>
<p>
For instance, this webpage defines the <tt>toggleBrowserPoniesToBackground</tt> function like so:
</p>
<pre class="code">
<span class="keyword">function</span> toggleBrowserPoniesToBackground () {
<span class="keyword">var</span> main = document.getElementById(<span class="literal">'main'</span>);
<span class="keyword">if</span> (main.style.zIndex === <span class="literal">''</span>) {
main.style.zIndex = <span class="literal">'100000000'</span>;
}
<span class="keyword">else</span> {
main.style.zIndex = <span class="literal">''</span>;
}
}
</pre>
<p>
In addition to that it defines these style rules:
</p>
<pre class="code">
<span class="keyword">#main</span> {
position: <span class="keyword">relative</span>;
background: <span class="keyword">rgba</span>(<span class="literal">255</span>, <span class="literal">255</span>, <span class="literal">255</span>, <span class="literal">0.8</span>)</span>;
border: <span class="literal">5px</span> <span class="keyword">solid</span> <span class="keyword">rgba</span>(<span class="literal">163</span>, <span class="literal">204</span>, <span class="literal">222</span>, <span class="literal">0.8</span>);
}
</pre>
<h3>Using your own ponies</h3>
<p>
If you want to use your own ponies you can convert the INI files to JavaScript using the tools below.
Just load the INI files, fix the filenames/URLs if needed and generate the JavaScript. The resulting
pony script will use the settings from above except for which pony is loaded.
</p>
<p>
<strong>Note:</strong>
This currently only works with Firefox and Chrome. Opera does currently not support files
being dropped (so click to use the file open dialog) and Internet Explorer currently cannot
read files at all in JavaScript (probably in version 10 it will be able to do that).
</p>
<h4>Your Ponies:</h4>
<div class="dropzone"
ondrop="dropPony.call(this,event);"
ondragover="dragoverPony.call(this,event);"
ondragenter="dragoverPony.call(this,event);"
ondragleave="dragleaveDropzone.call(this,event);"
onmousemove="mousemoveDropzone.call(this,event);">
Click or drop Pony.ini files here.
<input type="file" multiple="multiple" onchange="loadPonyFiles(this.files);"/>
</div>
<p>
As a next step you may need to adapt the URLs of the images and sounds to where they
really are hosted. If they are hosted on some web server with the files of each pony
in a seperate distinct directory you just need to change the base URL to the location
of said directory. Don't forget the / (slash) at the end of the base URL and please
note that the web is case sensitive. This means the file names as they are on the
server have to exactly the ones defined here.
</p>
<p>
If the files are all at some more or less random location, you need to adapt all the
URLs individually. In this case just enter an absolute URL in the URL fields of each
file. If the URL of an file is absolute the base URL will be ignored.
</p>
<p>
As a third option you can also embed the files directly in the generated script.
Note that this encodes the whole files into data URLs, which might cause the generated
script to be a lot bigger than the sum size of all the files. Also Internet Explorer
does not support data URLs of the length of 2048 characters, and the pony sprites
are usually an order of magnitude bigger than that.
</p>
<ul id="own-ponies"></ul>
<h4>Your Interacions:</h4>
<div class="dropzone"
ondrop="dropInteractions.call(this,event);"
ondragover="dragoverInteractions.call(this,event);"
ondragenter="dragoverInteractions.call(this,event);"
ondragleave="dragleaveDropzone.call(this,event);"
onmousemove="mousemoveDropzone.call(this,event);">
Click or drop Interactions.ini files here.
<input type="file" multiple="multiple" onchange="loadInteractionFiles(this.files);"/>
</div>
<ul id="own-interactions"></ul>
<p>
<label title="Common prefix of image/audio file URLs of all ponies. (Not needed if you embed the files.)">Base URL:
<input type="text" id="own-baseurl"/></label>
</p>
<p>
<button onclick="inisToJS();">Generate JavaScript Code</button>
</p>
<p>
<label for="javascript-output">your-ponies.js:</label>
<textarea class="code" id="javascript-output" rows="8"></textarea>
</p>
<p>
Then put the contents of the text area above into a file called e.g. <tt>"your-ponies.js"</tt>
and host it somewhere on the web. You can then embed your ponies on your web site by adding
this code somewhere in the HTML code of your web site (I recommend somewhere between
<tt><head></tt> and <tt></head></tt>):
</p>
<pre class="code">
<<span class="keyword">script</span> type=<span class="literal">"text/javascript"</span>
src=<span class="literal">"<span id="javascript-url">browser-ponies.js</span>"</span>></<span class="keyword">script</span>>
<<span class="keyword">script</span> type=<span class="literal">"text/javascript"</span>
src=<span class="literal">"http://example.org/your-ponies.js"</span>></<span class="keyword">script</span>>
</pre>
<p>
Of course you need to replace <tt>http://example.org/your-ponies.js</tt> with the URL where
you really host the file.
</p>
<p>
If you want to you can also copy the <tt>browserponies.js</tt> file and serve it yourself.
This server here does not have the best uptime so you might want to do that.
</p>
<h2>Best Pony</h2>
<p>
What is your favourite pony? Resort the list to tell me!
</p>
<iframe frameborder="0" height="1035" src="http://crowdranking.com/widgets/t89g0--best-pony.iframe?lang=en&v=1" style="border-style: none; width: 400px; height: 1035px; display: block; margin: auto;" width="400"></iframe>
<h2>Download</h2>
<p>
You can download the source without images/sounds here:<br/>
<a href="https://github.com/panzi/Browser-Ponies/archive/master.zip"
download="browser-ponies-source.zip">browser-ponies-source.zip</a>
</p>
<p>
Or with images/sounds:<br/>
<a href="https://github.com/panzi/Browser-Ponies/archive/gh-pages.zip"
download="browser-ponies-plus-resources.zip">browser-ponies-plus-resources.zip</a>
</p>
<p>
Note that none of the images are made by me. They simply are the images of
the <a href="http://www.ponychan.net/chan/collab/res/43172.html">Ponychan fork</a> of
<a href="http://sourceforge.net/projects/desktopponies/">Desktop Ponies</a>. Go there for a full list of
art credits. The only changes I made are fixes to the file names, because the web is case sensitive.
</p>
<p>
A git repository can be found here:<br/>
<a href="https://github.com/panzi/Browser-Ponies">https://github.com/panzi/Browser-Ponies</a>
</p>
<h2>License</h2>
<p>
The code of this software is licensed under the MIT license. This applies to all
JavaScript files (except basecfg.js and ponycfg.js), HTML, CSS, unix shell script
and Python files in this project. The license does not apply to any pony images,
*.ini files (or files compiled from these INI files) or sound files. These files
are copied from Desktop Ponies. The images and INI files are under various
licenses (mostly CC BY-NC-SA 3.0).
</p>
<p>Copyright © 2011-2013 Mathias Panzenböck</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</p>
<h2>Comments</h2>
<div id="disqus_thread"></div>
<a id="comments-button" href="javascript:void(0)">Show Comments</a>
</div>
<div id="footer">© 2011-2013 Mathias Panzenböck</div>
</body>
</html>