From 63e80b8dbddf670139f754072004d6fb5e24876d Mon Sep 17 00:00:00 2001 From: Jingwen Owen Ou Date: Mon, 8 Sep 2014 22:34:13 -0700 Subject: [PATCH] =?utf8?q?Add=20=E2=80=9CRun=E2=80=9D=20button=20to=20exec?= =?utf8?q?ute=20examples=20on=20jqplay.org?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- manual/index.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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'); + }); + });