CH Reload Frame Button

Adds a reload button on pages loaded in an iframe/frame. For more convenient access than the right-click menu, or for browser versions which don't have that menu command. Also shows the frame's URL in the button's mouseover text.

  1. // ==UserScript==
  2. // @name CH Reload Frame Button
  3. // @author clickhappier
  4. // @namespace clickhappier
  5. // @description Adds a reload button on pages loaded in an iframe/frame. For more convenient access than the right-click menu, or for browser versions which don't have that menu command. Also shows the frame's URL in the button's mouseover text.
  6. // @version 1.0c
  7. // @include *
  8. // @exclude http://platform.twitter.com/*
  9. // @exclude https://platform.twitter.com/*
  10. // @exclude http://www.facebook.com/*
  11. // @exclude https://www.facebook.com/*
  12. // @exclude http://www.youtube.com/embed/*
  13. // @exclude https://www.youtube.com/embed/*
  14. // @exclude http://player.vimeo.com/*
  15. // @exclude https://player.vimeo.com/*
  16. // @require http://code.jquery.com/jquery-latest.min.js
  17. // @grant GM_log
  18. // ==/UserScript==
  19.  
  20.  
  21. // if page is loaded in an iframe/frame
  22. if ( window.location != window.parent.location )
  23. {
  24. // add a reload button, if page doesn't already have one from mmmturkeybacon's script for Google-hosted MTurk HITs
  25. if ( $('input[type="button"][value="Reload"]').length < 1 )
  26. {
  27. // adapted from https://greasyfork.org/en/scripts/10449-mmmturkeybacon-google-iframe-reload-button/
  28. var button_holder = document.createElement("DIV");
  29. button_holder.style.cssText = "position: fixed; top: 0px; right: 0px; z-index: 20;";
  30. button_holder.innerHTML = '<input type="button" onclick="window.location.reload(true)" value="&#8635;" id="CHReloadFrame" style="font-size:150%;" title="CH Reload Frame: ' + window.location + '" />';
  31. document.body.insertBefore(button_holder, document.body.firstChild);
  32. }
  33. }