Created
July 30, 2012 15:09
-
-
Save tokapeb/3207650 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link rel="stylesheet" type="text/css" href="jcsdl/jcsdl.min.css" /> | |
| <link rel="stylesheet" type="text/css" href="over.css" /> | |
| <script type="text/javascript" src="jcsdl/jcsdl.definition.js"></script> | |
| <script type="text/javascript" src="jcsdl/jcsdl.min.js"></script> | |
| <script type="text/javascript"> | |
| $(function() { | |
| var $currentStream = $(); | |
| JCSDL.onLoad(function() { | |
| $('#jcsdl-edit').jcsdlGui({ | |
| save : function(code) { | |
| // add new item if none loaded) | |
| if ($currentStream.length == 0) { | |
| var $item = $('#streams-list li:first').clone(); | |
| $item.find('h4').html('New stream'); | |
| $item.find('.jcsdl-source').val(code); | |
| $item.appendTo('#streams-list'); | |
| } else { | |
| // save the output to the selected stream | |
| $currentStream.find('.jcsdl-source').val(code); | |
| } | |
| // display the output | |
| $('#jcsdl-edit-output').val(code); | |
| // hide the editor and show the list | |
| $('#jcsdl-edit').hide(); | |
| $('#streams-list').show(); | |
| }, | |
| cancel : function() { | |
| this.$container.fadeOut(this.config.animationSpeed, function() { | |
| $('#streams-list').show(); | |
| }); | |
| } | |
| }); | |
| }); | |
| $('#streams-list').on('click', '.edit', function(ev) { | |
| ev.preventDefault(); | |
| ev.target.blur(); | |
| $currentStream = $(this).closest('li'); | |
| var code = $currentStream.find('.jcsdl-source').val(); | |
| $('#jcsdl-edit').jcsdlGui('loadJCSDL', code); | |
| // clear the output as well | |
| $('#jcsdl-edit-output').val(''); | |
| // hide the list and show the editor | |
| $('#streams-list').hide(); | |
| $('#jcsdl-edit').show(); | |
| }); | |
| $('#streams-list').on('click', '.source', function(ev) { | |
| ev.preventDefault(); | |
| ev.target.blur(); | |
| var code = $(this).closest('li').find('.jcsdl-source').val(); | |
| $('#jcsdl-edit-output').val(code); | |
| }); | |
| var editor = new JCSDLGui('#jcsdl', { | |
| save : function(code) { | |
| alert(code); | |
| } | |
| }); | |
| }); | |
| </script> | |
| </head> | |
| <body> | |
| <div id="logo"></div> | |
| <div id="jcsdl-edit"></div> | |
| <h3>JCSDL Output:</h3> | |
| <textarea id="jcsdl-edit-output" disabled="true" style="width: 90%; margin: 20px auto; display: block; height: 200px;"></textarea> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment