Remove duplicate words from filenames (JScript array.indexOf error)

JScript arrays don't seem to support the indexOf method like JavaScript arrays do.

See e.g. https://stackoverflow.com/questions/26073853/js-file-doesnt-work.

The suggestion there is to roll your own function:

function arrayContains(array, value){
    for (var i = 0, e = array.length; i < e; ++i) {
        if (array[i] === value) {
            return true;
        }
    }
    return false;
}