This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.repl-1.0.2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-repl.git
commit 4e696959c401d04203d08fa64ab6c6c4ba004f45 Author: Radu Cotescu <[email protected]> AuthorDate: Thu Oct 8 10:54:01 2015 +0000 SLING-5127 - Implement browser history support for the Sightly REPL tabs * added history events for the Source, View and Java tabs git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/repl@1707474 13f79535-47bb-0310-9956-ffa450edef68 --- .../resources/SLING-INF/etc/clientlibs/repl/script.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/resources/SLING-INF/etc/clientlibs/repl/script.js b/src/main/resources/SLING-INF/etc/clientlibs/repl/script.js index 0f96a71..bb31fd5 100644 --- a/src/main/resources/SLING-INF/etc/clientlibs/repl/script.js +++ b/src/main/resources/SLING-INF/etc/clientlibs/repl/script.js @@ -21,7 +21,8 @@ jQuery(function ($) { 'use strict'; - var currentState = 'source'; + var hash = window.location.hash; + var currentState = hash ? hash.substr(1) : 'source'; // Limits the number of times the function gets called for event handlers function debounce(fn, delay) { @@ -134,19 +135,28 @@ jQuery(function ($) { // Setup output tabs var allTargets = $('.output-view'); $('a[data-toggle=tab]').each(function () { - var link = $(this); - var target = allTargets.filter(link.attr('href')); - var state = target.attr('id'); + var link = $(this), + href = link.attr('href'), + target = allTargets.filter(href), + state = target.attr('id'); link.click(function () { currentState = state; allTargets.addClass('hidden'); target.removeClass('hidden'); reloadOutput(); + window.location = href; }); }); + + $(window).on('hashchange', function () { + hash = window.location.hash; + currentState = hash ? hash.substr(1) : 'source'; + $('a[href=#' + currentState + ']').click(); + }); } init(); + $('a[href=#' + currentState + ']').click(); }); -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
