YouTube Unblocker

Adds menu button to automatically forward any currently blocked YouTube video to youtubeunblocker.org and unblocks the video.

目前為 2015-11-10 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name YouTube Unblocker
  3. // @namespace YTUB
  4. // @version 2.1
  5. // @description Adds menu button to automatically forward any currently blocked YouTube video to youtubeunblocker.org and unblocks the video.
  6. // @author drhouse
  7. // @include https://www.youtube.com/*
  8. // @include http://www.youtubeunblocker.org/
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // @grant GM_deleteValue
  12. // @grant GM_registerMenuCommand
  13. // @grant GM_notification
  14. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  15. // @icon https://s.ytimg.com/yts/img/favicon-vfldLzJxy.ico
  16. // @locale en
  17. // ==/UserScript==
  18. $(document).ready(function () {
  19.  
  20. $("a").removeClass("spf-link").not("#watch-appbar-playlist");
  21.  
  22. GM_registerMenuCommand("YouTube Unblocker", function(){
  23. if (location != "http://www.youtubeunblocker.org/"){
  24. var here = top.location.href;
  25. var title = document.title;
  26. GM_deleteValue("ytube");
  27. GM_deleteValue("ytubetitle");
  28. GM_setValue("ytube", here);
  29. GM_setValue("ytubetitle", title);
  30. window.location.href = 'http://www.youtubeunblocker.org/';
  31. }
  32. });
  33.  
  34. if (location == "http://www.youtubeunblocker.org/"){
  35. var target = 'body > div.main_bg > div.container > div:nth-child(12) > div.main_form_container > div > form > p';
  36. var target1 = target + ' > input.form';
  37. var target2 = target + ' > input.button';
  38. var storedObject = GM_getValue("ytube");
  39. var storedObjectTitle = GM_getValue("ytubetitle");
  40. var msg = new SpeechSynthesisUtterance('Now unblocking ' + storedObjectTitle);
  41. msg.lang = 'en-US';
  42. window.speechSynthesis.speak(msg);
  43. $(target1).val(storedObject);
  44. GM_notification(storedObjectTitle, "Unblocking");
  45. $(target2).click();
  46. }
  47. });