Advertisement
Guest User

Highlight Unhighlightable Text (CrowdSource)

a guest
Jun 5th, 2014
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Highlight Unhighlightable Text (CrowdSource)
  3. // @namespace http://mturkwiki.net/forums
  4. // @version 1.0
  5. // @description Allows highlighting of unhighlightable text.
  6. // @match https://*.mturk.com/*
  7. // @match https://work.crowdsource.com/amt/view*
  8. // @grant GM_setClipboard
  9. // ==/UserScript==
  10.  
  11. function withPages_jQuery(NAMED_FunctionToRun)
  12. {
  13. var funcText = NAMED_FunctionToRun.toString ();
  14. var funcName = funcText.replace (/^function\s+(\w+)\s*\((.|\n|\r)+$/, "$1");
  15. var script = document.createElement("script");
  16. script.textContent = funcText + "\n\n";
  17. script.textContent += 'jQuery(document).ready(function() {'+funcName+'(jQuery);});';
  18. document.body.appendChild(script);
  19. };
  20.  
  21. function main0($)
  22. {
  23. function create_href(self)
  24. {
  25. /*div = document.createElement("div");
  26. div.innerHTML = "Copy"
  27. div.text0 = self.innerText.replace("Keyword: ", "");
  28. div.addEventListener("click", function()
  29. {
  30. GM_setClipboard(div.text0);
  31. });
  32. self.appendChild(div);*/
  33. }
  34.  
  35. function gen_search_url(text)
  36. {
  37. text = text.replace(" ", "+")
  38. text = "https://www.google.com/search?channel=fs&q=" + text + "&ie=utf-8&oe=utf-8";
  39. return text;
  40. }
  41.  
  42. $.extend($.fn.enableTextSelect = function()
  43. {
  44. return this.each(function()
  45. {
  46. $(this).unbind("mousedown");
  47. create_href(this);
  48. });
  49. });
  50.  
  51. $(this).unbind("mousedown");
  52.  
  53. $("h2.text-rep")
  54. .enableTextSelect()
  55. .attr("unselectable", "off")
  56. .css({"-moz-user-select":"auto","-webkit-user-select":"auto","user-select":"auto"});
  57.  
  58. console.log("Selectoid finished");
  59. }
  60.  
  61. if (window.top === window.self)
  62. {
  63. //withPages_jQuery(main0);
  64. }
  65. else
  66. {
  67. withPages_jQuery(main0);
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement