created the appendScript function to dry future code
first useful working version of the script
added some comments for increased code readability
modified a comment to fix typo
added some comments to the code
added/moved comments
modified display mode default option to images
modified the js code to keep it dry