Search Selected text on Amazon .ca

Im Mahi , and this script helps people to select and search a product by name without having to download any new Search extension, with single click | Saves lot of time for e-commerce employees. CANADA version

  1. // ==UserScript==
  2. // @description Im Mahi , and this script helps people to select and search a product by name without having to download any new Search extension, with single click | Saves lot of time for e-commerce employees. CANADA version
  3.  
  4.  
  5. // @name Search Selected text on Amazon .ca
  6. // @copyright Mahi Balan M | VBI
  7. // @version 1.23
  8. // @website https://phonetool.amazon.ca/users/mahibala
  9. // @namespace *
  10. // @include *
  11. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
  12. // @author Mahi Balan .M
  13. // ==/UserScript==
  14. // ==/UserScript==
  15. $(document).ready(function(){
  16. $("body").mouseup(function(e){
  17. // get selected text
  18. var seltext = getSelectedText();
  19. if(seltext != "")
  20. {
  21. if($(".searchit").attr("class") == null)
  22. {
  23. $("<a></a>").appendTo("body")
  24. .attr("title","Search Product on Amazon.ca | MB")
  25. .attr("class","searchit")
  26. .css("width","24px")
  27. .css("height","24px")
  28. .css("background-image","url(http://lh4.ggpht.com/_9NnLYMRJob8/TQ9GrnFaweI/AAAAAAAAAVc/f4UtNPKEMUU/find.png)")
  29. .css("display","inline")
  30. .css("background-position","0px 0px")
  31. .attr("href","https://www.amazon.ca/s?ie=UTF8&field-keywords="+seltext)
  32. .attr("target","_blank")
  33. .css("left",e.pageX - 5)
  34. .css("top",e.pageY - 30)
  35. .css("display","block")
  36. .css("position","absolute")
  37. .hide()
  38. .fadeIn(0.1);
  39. }
  40. else{
  41. $(".searchit").animate({"left": e.pageX - 2,"top" : e.pageY - 30}, 0.1)
  42. .attr("href","https://www.amazon.ca/s?ie=UTF8&field-keywords="+seltext).fadeIn(0.1);
  43. }
  44. }
  45. else
  46. $(".searchit").fadeOut("very very fast");
  47. });
  48. $(".searchit").mouseover(function(){
  49. alert("asa");
  50. });
  51. });
  52. function getSelectedText()
  53. {
  54. // For Firefox
  55. if(window.getSelection)
  56. return window.getSelection();
  57. else if(document.getSelection)
  58. return document.getSelection();
  59. else
  60. {
  61. // For IE
  62. var selection = document.selection && document.selection.createRange();
  63. if(selection.text)
  64. return selection.text;
  65. return false;
  66. }
  67. return false;
  68. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址