-
Notifications
You must be signed in to change notification settings - Fork 0
/
my.js
39 lines (30 loc) · 1016 Bytes
/
my.js
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
$(function(){
$.deck.defaults.codemirror.indentUnit=2;
$('h2').live('dragstart', function(e)
{
var parent = $(this).parents('section');
var src=$(parent).find('.src textarea').data('codemirroreditor').getValue();
var test=$(parent).find('.test textarea').data('codemirroreditor').getValue();
var contents="data:text/javascript;base64,"+btoa(
"/********* Code **********/\n\n"+
src+
"\n\n/********* Test **********/\n\n"+
test);
e.originalEvent.dataTransfer.setData('DownloadURL', 'text/javascript:tmp.js:'+contents);
});
$('.fill').live('click', function(e)
{
var slide = $(this).parents('section'),
parent = $(this).parents('.codeblock'),
textarea = $(parent).find('textarea');
$.get($(this).attr('href'), function(txt)
{
$(textarea).data('codemirroreditor').setValue(txt);
});
e.preventDefault();
});
$('.eval').live('click', function(e)
{
eval($(this).parents('.codeblock').find('textarea').data('codemirroreditor').getValue());
});
});