Youtube Link Fix for addons/scripts

[Works in FF and Chrome!] changes youtube links to refresh whole page, so other scripts will work.

目前为 2015-08-09 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube Link Fix for addons/scripts
  3. // @namespace http://www.youtube.com/
  4. // @version 0.4
  5. // @description [Works in FF and Chrome!] changes youtube links to refresh whole page, so other scripts will work.
  6. // @author William H
  7. // @include *youtube.com/watch?v=*
  8. // @grant none
  9. // @require http://code.jquery.com/jquery-latest.js
  10. // ==/UserScript==
  11.  
  12. window.addEventListener("load", convertMyLinks($("[class^='yt-uix-sessionlink content-link spf-link spf-link ']")), false);
  13.  
  14. if(document.readyState == "complete"){
  15. convertMyLinks($("[class^='yt-uix-sessionlink content-link spf-link spf-link ']"));
  16. }
  17.  
  18. function convertMyLinks(elemArray) {
  19. for (i = 0; i < elemArray.length; i += 1) {
  20. $(elemArray[i]).attr("href", elemArray[i].href).removeAttr('data-sessionlink').removeAttr('rel').attr('class', $(elemArray[i]).attr('class').split(" spf-link ")[0]);
  21. }
  22. }