2014-12-07 14:12:50 +01:00
|
|
|
requirejs.config({
|
|
|
|
// baseUrl: '/',
|
|
|
|
paths: {
|
2014-12-25 11:13:07 +01:00
|
|
|
lodash: 'http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min',
|
2014-12-07 14:12:50 +01:00
|
|
|
jquery: 'http://code.jquery.com/jquery-1.11.0.min',
|
|
|
|
firebase: 'https://cdn.firebase.com/js/client/2.0.5/firebase',
|
2014-12-25 11:13:07 +01:00
|
|
|
react: 'http://fb.me/react-with-addons-0.12.1.min',
|
2014-12-07 14:12:50 +01:00
|
|
|
//ace: '../ace-builds-1.1.8/src-min/ace',
|
2014-12-08 13:48:12 +01:00
|
|
|
fiddle: './fiddle',
|
|
|
|
text: 'libs/requirejs-plugins/text',
|
2014-12-25 11:13:07 +01:00
|
|
|
json: 'libs/requirejs-plugins/json'
|
2014-12-09 14:31:25 +01:00
|
|
|
//codeMirror: 'libs/codemirror-4.8/lib/codemirror',
|
|
|
|
//htmlmixed: 'libs/codemirror-4.8/mode/htmlmixed/htmlmixed',
|
|
|
|
//javascript: 'libs/codemirror-4.8/mode/javascript/javascript'
|
2014-12-07 14:12:50 +01:00
|
|
|
//'react/addons': 'http://fb.me/react-with-addons-0.12.1'
|
|
|
|
},
|
|
|
|
shim: {
|
2014-12-08 11:45:32 +01:00
|
|
|
lodash: {exports: '_'},
|
|
|
|
firebase: {exports: 'Firebase'},
|
2014-12-07 14:12:50 +01:00
|
|
|
//ace: { exports: 'ace' },
|
2014-12-08 11:45:32 +01:00
|
|
|
jquery: {exports: '$'},
|
|
|
|
react: {exports: 'React'}
|
2014-12-07 14:12:50 +01:00
|
|
|
},
|
|
|
|
map: {
|
|
|
|
'*': {
|
|
|
|
'react/addons': 'react'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
requirejs(['jquery', 'react', 'fiddle'], function ($, React, fiddle) {
|
|
|
|
'use strict';
|
|
|
|
window.fiddle = React.render(fiddle(), document.getElementById('container'));
|
2014-12-08 11:45:32 +01:00
|
|
|
$(function () {
|
|
|
|
$(window).resize(calcSize);
|
|
|
|
calcSize();
|
|
|
|
});
|
|
|
|
|
|
|
|
function calcSize() {
|
|
|
|
var contentHeight = $(document).height() - 48;
|
|
|
|
//$('#container').height(contentHeight).width($(document).width());
|
|
|
|
//$('.code-area').each(function (i) {
|
|
|
|
// var h = (contentHeight / 2) - 10;
|
|
|
|
// var w = ($(document).width() / 2) - 10;
|
|
|
|
// $(this).height(h).width(w);
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
2014-12-08 13:48:12 +01:00
|
|
|
//var h = (contentHeight / 2) - 10;
|
|
|
|
//var w = ($(document).width() / 2) - 10;
|
2014-12-08 11:45:32 +01:00
|
|
|
//var size = getWindowSize();
|
|
|
|
//$('#editor-rt').css({
|
|
|
|
// top: 50, left: 0, bottom: h, right: w, position: 'absolute'
|
|
|
|
//});
|
|
|
|
//$('#editor-code').css({
|
|
|
|
// top: 50, left: w, bottom: h, right: 0, position: 'absolute'
|
|
|
|
//});
|
|
|
|
//$('#editor-generated').css({
|
|
|
|
// top: 50 + h, left: 0, bottom: 0, right: w, position: 'absolute'
|
|
|
|
//});
|
|
|
|
//$('#result-area').css({
|
|
|
|
// top: 50 + h, left: w, bottom: 0, right: 0, position: 'absolute'
|
|
|
|
//});
|
|
|
|
|
|
|
|
//$('.code-area').each(function (i, k) {
|
|
|
|
// //var h = (contentHeight / 2) - 10;
|
|
|
|
// //var w = ($(document).width() / 2) - 10;
|
|
|
|
// //$(this).height(h).width(w);
|
|
|
|
// $(this).css({
|
|
|
|
// top: 50 + h, left: w, bottom: 0, right: 0, position: 'absolute'
|
|
|
|
// });
|
|
|
|
//});
|
|
|
|
|
|
|
|
$('.large-text-area').each(function (i, k) {
|
|
|
|
//var h = (contentHeight / 2) - 10;
|
|
|
|
//var w = ($(document).width() / 2) - 10;
|
|
|
|
var $this = $(this);
|
|
|
|
$this.height($this.parent().height() - 2).width($this.parent().width() - 2);
|
2014-12-09 14:31:25 +01:00
|
|
|
//$this.children().height($this.parent().height() - 2).width($this.parent().width() - 2);
|
2014-12-08 11:45:32 +01:00
|
|
|
});
|
2014-12-09 14:31:25 +01:00
|
|
|
var $result = $('#result-container');
|
|
|
|
$result.height($result.parent().height() - 2).width($result.parent().width() - 2);
|
2014-12-08 11:45:32 +01:00
|
|
|
}
|
2014-12-07 14:12:50 +01:00
|
|
|
});
|
|
|
|
|