File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ description: Learn to program in Ruby in 30 minutes
2929 </div>
3030
3131 <select id="tryruby-index" class="form-control"></select>
32-
32+
3333 <div id="tryruby-explanation">
3434
3535 <h2 id="tryruby-title">Got 30 minutes? Give Ruby a shot right now!</h2>
@@ -38,7 +38,7 @@ description: Learn to program in Ruby in 30 minutes
3838 <p>Ruby is a programming language from Japan which is revolutionizing software development.</p>
3939 <p>The beauty of Ruby is found in its balance between simplicity and power.</p>
4040 <p>You can type some Ruby code in the editor and use these buttons to navigate:</p>
41-
41+
4242 <ul>
4343 <li><strong>Run</strong> → Executes the code in the editor</li>
4444 <li><strong>Copy</strong> → Copies the example code to the editor</li>
@@ -49,9 +49,6 @@ description: Learn to program in Ruby in 30 minutes
4949
5050 <h3>Click on <strong>Next</strong> to start learning.</h3>
5151 </div>
52-
53- <div id="tryruby-answer" style="display:none"></div>
54-
5552 </div>
5653 </div >
5754
Original file line number Diff line number Diff line change 55require 'promise'
66require 'browser/setup/full'
77require 'browser/cookies'
8+ require 'browser/form_data'
89
910# Container for individual lessons
1011class TryRubyItem
@@ -334,9 +335,10 @@ def do_change_lang
334335
335336 # Playground methods
336337 def get_code_from_url
337- hash = $$. decodeURIComponent ( $$[ :location ] [ :hash ] . gsub ( '+' , ' ' ) )
338+ hash = $document. location . fragment . to_s
339+ hash = Browser ::FormData . decode ( hash . gsub ( '+' , ' ' ) )
338340
339- hash [ ' #code=' . size ..- 1 ] if hash . start_with? ( '#code=' )
341+ hash . delete_prefix ( " #code=" ) if hash . start_with? ( '#code=' )
340342 end
341343
342344 def do_copy_url
@@ -381,7 +383,6 @@ def update_screen(item)
381383 @updating = true
382384 title_element . inner_html = item . title
383385 $document. at_css ( '#tryruby-content' ) . inner_html = item . text
384- $document. at_css ( '#tryruby-answer' ) . inner_html = item . answer
385386 @editor . value = item . saved_editor if @editor
386387 @output . value = item . saved_output if @output
387388 @current_copycode = get_code_fragment ( item . text )
You can’t perform that action at this time.
0 commit comments