Changeset 828
- Timestamp:
- 02/04/14 16:59:25 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/io/WebParser.java
r824 r828 289 289 290 290 final MutableBool bottomReached = new MutableBool(false); 291 final MutableBool rightReached = new MutableBool(false); 291 292 292 293 final MutableInt pageCount = new MutableInt(0); … … 317 318 @Override 318 319 public void handle(long arg0) { 319 System.out.println(frameCount);320 320 // Must wait 2 frames before taking a snapshot of the webview, otherwise JavaFX won't have redrawn 321 321 if (frameCount++ > 1) { … … 340 340 341 341 WebParser.addTextToFrame(visibleWidth, visibleHeight, window, webEngine, frameToAddTo); 342 System.out.println("added text"); 342 343 343 FrameIO.SaveFrame(frameToAddTo); 344 344 } catch (Exception ex) { … … 438 438 webEngine.executeScript("" 439 439 // Initializing the counter used when scrolling the page 440 + "var scrollCounter = 0;"); 440 + "var scrollCounter = 0;" 441 + "var scrollCounterHorizontal = 0;"); 441 442 442 443 // Setting up the element that contains the CSS to hide all text. … … 573 574 } 574 575 575 while (!bottomReached.getValue()) { 576 // Loop that scrolls the page horizontally 577 while (!rightReached.getValue()) { 578 bottomReached.setValue(false); 579 576 580 Platform.runLater(new Runnable() { 577 581 @Override … … 580 584 // Scrolling down the page 581 585 webEngine.executeScript("" 582 + "window.scrollTo(0, scrollCounter * 0.9 * window.innerHeight);" 583 + "scrollCounter = scrollCounter+1;"); 584 585 System.out.println("Scrolling"); 586 587 bottomReached.setValue((Boolean) webEngine.executeScript("(window.pageYOffset + window.innerHeight >= document.documentElement.scrollHeight)")); 588 589 synchronized (notifier) { 590 notifier.notify(); 591 } 586 + "scrollCounter = 0;" 587 + "window.scrollTo(scrollCounterHorizontal * 0.9 * window.innerWidth, 0);" 588 + "scrollCounterHorizontal = scrollCounterHorizontal+1;"); 589 590 rightReached.setValue((boolean) webEngine.executeScript("(window.pageXOffset + window.innerWidth >= document.documentElement.scrollWidth)")); 592 591 593 592 } catch (Exception e) { … … 596 595 } 597 596 }); 598 599 synchronized (notifier) { 600 try { 601 // Waiting for the page to be scrolled 602 notifier.wait(); 603 } catch (InterruptedException e) { 604 // TODO Auto-generated catch block 605 e.printStackTrace(); 606 } 607 } 608 609 timer.start(); 610 611 synchronized (notifier) { 612 try { 613 // Waiting for the timer thread to finish before looping again 614 notifier.wait(); 615 } catch (InterruptedException e) { 616 // TODO Auto-generated catch block 617 e.printStackTrace(); 618 } 619 } 620 597 598 // Loop that scrolls the page vertically (for each horizontal scroll position) 599 while (!bottomReached.getValue()) { 600 Platform.runLater(new Runnable() { 601 @Override 602 public void run() { 603 try { 604 // Scrolling down the page 605 webEngine.executeScript("" 606 + "window.scrollTo(window.pageXOffset, scrollCounter * 0.9 * window.innerHeight);" 607 + "scrollCounter = scrollCounter+1;"); 608 609 bottomReached.setValue((Boolean) webEngine.executeScript("(window.pageYOffset + window.innerHeight >= document.documentElement.scrollHeight)")); 610 611 synchronized (notifier) { 612 notifier.notify(); 613 } 614 615 } catch (Exception e) { 616 e.printStackTrace(); 617 } 618 } 619 }); 620 621 synchronized (notifier) { 622 try { 623 // Waiting for the page to be scrolled 624 notifier.wait(); 625 } catch (InterruptedException e) { 626 // TODO Auto-generated catch block 627 e.printStackTrace(); 628 } 629 } 630 631 timer.start(); 632 633 synchronized (notifier) { 634 try { 635 // Waiting for the timer thread to finish before looping again 636 notifier.wait(); 637 } catch (InterruptedException e) { 638 // TODO Auto-generated catch block 639 e.printStackTrace(); 640 } 641 } 642 643 } 621 644 } 622 645 … … 882 905 // If the element has a background color then add it (to Expeditee) as a rectangle with that background color 883 906 if (bgColor != null) { 884 System.out.println("bg");885 907 frame.addRectangle(Math.round(x), Math.round(y), Math.round(width), Math.round(height), 0, null, bgColor); 886 908 }
Note:
See TracChangeset
for help on using the changeset viewer.