Create loader.js

added main javascript code