From: Jingwen Owen Ou Date: Tue, 9 Sep 2014 05:34:13 +0000 (-0700) Subject: Add “Run” button to execute examples on jqplay.org X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=refs%2Fpull%2F573%2Fhead;p=jq Add “Run” button to execute examples on jqplay.org --- diff --git a/manual/index.html b/manual/index.html index 4df3598..99f9cb1 100644 --- a/manual/index.html +++ b/manual/index.html @@ -268,6 +268,20 @@ } }); }); + + // add "Run" button to execute examples on jqplay.org + $(function() { + $.each($('table.manual-example'), function(index, value) { + $value = $(value) + + var j = $value.find('tr:nth-child(2) td:first').text(); + var q = $value.find('.jqprogram').text().replace(/^jq /, '').replace(/^'(.+)'$/, '$1'); + var url = 'https://jqplay.org/jq?q=' + encodeURIComponent(q) +'&j=' + encodeURIComponent(j) + + var $last_tr = $value.find('tr:last'); + $last_tr.after('Run'); + }); + });