encodeURIComponent on dirname

Conflicts:
	js/viewer/viewer.js