4chan /gif/ sound fix - CORS issue

Fix webm that are silenced because of CORS

  1. // ==UserScript==
  2. // @name 4chan /gif/ sound fix - CORS issue
  3. // @version 0.1
  4. // @description Fix webm that are silenced because of CORS
  5. // @namespace https://greasyfork.org/users/191481
  6. // @author Zeper
  7. // @match *://*.4chan.org/gif/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=4chan.org
  9. // @grant unsafeWindow
  10. // ==/UserScript==
  11.  
  12. var expandWebm_OStr = unsafeWindow.ImageExpansion.expandWebm.toString();
  13. var regexResult = expandWebm_OStr.match(/(\w+)\.className\s*=\s*("|')expandedWebm\2([,;])/i);
  14. eval((expandWebm_OStr.replace(regexResult[0],regexResult[1]+".crossOrigin="+regexResult[2]+"anonymous"+regexResult[2]+regexResult[3])).replace("function",'function expandWebm'));
  15. unsafeWindow.ImageExpansion.expandWebm = expandWebm;