Fix for window.open() links and replaced lines with a for-loop (2)

Updated functionality to get links and files from javascript:window.open() links.
Also replaced a few lines with a for-loop.
Merge pull request #3 from epaaj/patch-1

Fix for window.open() links and replaced lines with a for-loop (2)