|
|
@@ -110,25 +110,11 @@ $(document).ready(function() {
|
|
|
|
|
|
_ws.makeView('sandbox-iframe', {
|
|
|
render: function(src) {
|
|
|
- // console.log('change iframe src', '/examples/' + navState.repo + '/' + navState.example);
|
|
|
this.$elem.prop('src', src);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
- // /**
|
|
|
- // * Set the current hash. If none given, take it from lococation.hash
|
|
|
- // */
|
|
|
- // function setCurrentHash(slug) {
|
|
|
- // if(slug) {
|
|
|
- // window.location.hash = currentHash = slug;
|
|
|
- // }
|
|
|
- // else {
|
|
|
- // currentHash = window.location.hash ?
|
|
|
- // window.location.hash.substr(1) : undefined;
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
|
|
|
// /**
|
|
|
// * Set editor mode (html, javascript, css)
|
|
|
@@ -163,93 +149,6 @@ $(document).ready(function() {
|
|
|
|
|
|
// editor.getSession().on('change', editorContentChanged);
|
|
|
|
|
|
- // function setActiveTab(mode) {
|
|
|
- // console.log('setting mode', mode);
|
|
|
- // var elementId = 'show-' + mode;
|
|
|
- // $('#show-' + activeMode).removeClass('active');
|
|
|
- // activeMode = mode;
|
|
|
- // $('#' + elementId).addClass('active');
|
|
|
- // var ed = $('#editor-' + mode);
|
|
|
- // setEditorMode(mode);
|
|
|
- // editor.getSession().off('change');
|
|
|
- // editor.getSession().setValue(ed[0].innerHTML);
|
|
|
- // editor.getSession().on('change', editorContentChanged);
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
- // function loadExample(exampleSlug) {
|
|
|
- // // console.log('loadExample', exampleSlug);
|
|
|
- // var serverPath = 'exemples/jquery/' + exampleSlug + '/';
|
|
|
- // rp.get(serverPath + 'script.js', 'text')
|
|
|
- // .then(javascript => $editorJs.html(javascript))
|
|
|
- // .then(() => rp.get(serverPath + 'example.html', 'text'))
|
|
|
- // .then(() => rp.get(serverPath + 'styles.css', 'text')
|
|
|
- // .then(css => $editorCss.html(css))
|
|
|
- // .catch(err => {
|
|
|
- // return '';
|
|
|
- // })
|
|
|
- // )
|
|
|
- // .then(html => {
|
|
|
- // $editorHtml.html(html);
|
|
|
- // $('iframe.panel-right')
|
|
|
- // .prop('src', '/examples/' + exampleSlug)
|
|
|
- // setActiveTab('html');
|
|
|
- // setCurrentHash(exampleSlug);
|
|
|
- // var sources = {
|
|
|
- // html: $editorHtml.html(),
|
|
|
- // javascript: $editorJs.html()
|
|
|
- // };
|
|
|
- // editorStorage.init(exampleSlug, sources);
|
|
|
- // })
|
|
|
- // .then(() => {
|
|
|
- // var item = _.find(exampleList, { slug: exampleSlug });
|
|
|
- // // console.log(item.test ? 'test' : 'no test');
|
|
|
- // // loadJS('exemples/' + item.slug + '/test.js', function() {
|
|
|
- // // $('#tests').show();
|
|
|
- // // });
|
|
|
- // });
|
|
|
-
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // function loadExampleList() {
|
|
|
- // rp.get('/list/jquery', 'json')
|
|
|
- // .then(function(_exampleList) {
|
|
|
- // exampleList = _exampleList;
|
|
|
- // var restoredDraft;
|
|
|
- // resetFileSelect(exampleList);
|
|
|
- // if(currentHash) {
|
|
|
- // $fileSelect.val(currentHash);
|
|
|
- // var item = _.find(exampleList, { slug: currentHash });
|
|
|
- // if( ! item) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // restoredDraft = editorStorage.restore(item.slug);
|
|
|
- // if(! restoredDraft) {
|
|
|
- // loadExample(item.slug);
|
|
|
- // }
|
|
|
- // else {
|
|
|
- // console.log('restore', item.slug, restoredDraft.sources);
|
|
|
- // $editorHtml.html(restoredDraft.sources.html);
|
|
|
- // $editorCss.html(restoredDraft.sources.css);
|
|
|
- // $editorJs.html(restoredDraft.sources.javascript);
|
|
|
- // $('iframe.panel-right')
|
|
|
- // .prop('src', '/examples/' + item.slug)
|
|
|
-
|
|
|
- // // loadJS('exemples/' + item.slug + '/script.js');
|
|
|
- // // if(item.test) {
|
|
|
- // // loadJS('exemples/' + item.slug + '/test.js', function() {
|
|
|
- // // $('#tests').show();
|
|
|
- // // });
|
|
|
- // // }
|
|
|
- // setActiveTab('html');
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }
|
|
|
-
|
|
|
|
|
|
// function revertEditor() {
|
|
|
// editorStorage.reset();
|
|
|
@@ -277,23 +176,3 @@ $(document).ready(function() {
|
|
|
// loadExampleList();
|
|
|
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // var $editorJs = $('#editor-javascript');
|
|
|
- // var $editorHtml = $('#editor-html');
|
|
|
- // var $editorCss = $('#editor-css');
|
|
|
- // var $htmlContent = $('#html-content'); // replaced by iframe
|
|
|
- // var $selectorNav = $('#selector');
|
|
|
-
|
|
|
-
|
|
|
- // /**
|
|
|
- // * Handle window resize
|
|
|
- // */
|
|
|
- // function onResize() {
|
|
|
- // $editor.width($panelLeft.width());
|
|
|
- // $panelWrap.height($window.height());
|
|
|
- // }
|
|
|
- // $window.resize(onResize);
|
|
|
- // onResize();
|