Advertisement
Guest User

Untitled

a guest
Jul 11th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. var body=document.getElementById("search");
  2.  
  3. //creates bar and creates bar removal function
  4. var bar = document.createElement("DIV");
  5. function removeBar(){
  6. bar.remove();
  7. }
  8.  
  9. //styles bar
  10. var ds = bar.style;
  11. ds.position = "fixed";
  12. ds.width = "512px";
  13. ds.height = "33px";
  14. ds.background = "rgba(0,0,0,0.86)";
  15. ds.zIndex = "9999999999999";
  16.  
  17. //creates X button and makes it so clicking it runs the removeBar() function
  18. var x = document.createElement("BUTTON");
  19. x.onclick = removeBar;
  20. bar.appendChild(x);
  21.  
  22. //styles button
  23. var xs = x.style;
  24. xs.background = "black";
  25. xs.borderColor = "black";
  26. xs.color = "rgba(255,255,255,.86)";
  27. xs.position = "fixed";
  28. xs.left = "100%";
  29. xs.marginTop = "5px";
  30. xs.marginLeft = "-29px"
  31.  
  32. //puts X in button
  33. var xtext = document.createTextNode("X");
  34. x.appendChild(xtext);
  35.  
  36. //puts bar in page
  37. body.insertBefore(bar, body.children[0]);
  38.  
  39. {
  40. "manifest_version": 2,
  41. "name": "Inject script in webpage",
  42. "version": "2.0.1",
  43. "description": "inject script in webpage.",
  44.  
  45. "icons": {
  46. "48" : "sample-48.png",
  47. "128" : "sample-128.png"
  48. },
  49. "content_scripts": [
  50. {
  51. "matches": ["https://www.google.com.pk/*"],
  52. "js" : ["inject.js"],
  53. "all_frames": true
  54. }
  55. ]
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement