Changeset 889


Ignore:
Timestamp:
02/14/14 02:22:53 (10 years ago)
Author:
ngw8
Message:

Web parser now scrolls back to the original position once it's finished

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/io/WebParser.java

    r886 r889  
    431431                                                                // Initializing the counter used when scrolling the page
    432432                                                                + "var scrollCounter = 0;"
    433                                                                 + "var scrollCounterHorizontal = 0;");
     433                                                                + "var scrollCounterHorizontal = 0;"
     434                                                               
     435                                                                // Storing the current scroll position
     436                                                                + "var originalScrollX = window.pageXOffset;"
     437                                                                + "var originalScrollY = window.pageYOffset");
     438                                               
     439                                               
    434440
    435441                                                // Setting up the element that contains the CSS to hide all text. Also hiding readability mode buttons.
     
    535541                                                        // Will never reach 100% here, as the processing is not quite finished - progress is set to 100% at the end of
    536542                                                        // the addPageToFrame loop below
    537                                                         progressBar.set((50 * (j + 1)) / nodesLength);
     543                                                        try {
     544                                                                progressBar.set((50 * (j + 1)) / nodesLength);
     545                                                        } catch (ArrayIndexOutOfBoundsException e) {
     546                                                                e.printStackTrace();
     547                                                        }
    538548                                                }
    539549
     
    652662                                @Override
    653663                                public void run() {
     664                                        // Scrolling to the original position on the page
     665                                        webEngine.executeScript("window.scrollTo(originalScrollX, originalScrollY)");
    654666                                        // Reloading the page once the parsing is done - only realistic way to reset (i.e. remove all the added WordSpan tags)
    655667                                        // the page
Note: See TracChangeset for help on using the changeset viewer.