Update patch_window.js

Wrapped device.platform with if(){}