Advertisement
Guest User

Omegle timestamps

a guest
Apr 3rd, 2018
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Omegle timestamps
  3. // @version 0
  4. // @match *://*.omegle.com/
  5. // @grant unsafeWindow
  6. // ==/UserScript==
  7.  
  8. function win() {
  9. try {
  10. return unsafeWindow;
  11. } catch (e) {
  12. return window;
  13. }
  14. }
  15.  
  16. function wrap(fun) {
  17. try {
  18. return exportFunction(fun, unsafeWindow);
  19. } catch (e) {
  20. return fun;
  21. }
  22. }
  23.  
  24. function clone(obj) {
  25. try {
  26. return cloneInto(obj, unsafeWindow);
  27. } catch (e) {
  28. return obj;
  29. }
  30. }
  31.  
  32. function begin() {
  33. let window = win();
  34. if (!window.Element)
  35. setTimeout(begin, 1000);
  36.  
  37. if (!window.Timestamp$Element)
  38. window.Timestamp$Element = window.Element;
  39.  
  40. window.Element = wrap(function (a, b) {
  41. let clonedB = b && clone(b);
  42. let elem = window.Timestamp$Element(a, clonedB);
  43.  
  44. if (typeof a == "string" && b && (b["class"] == "youmsg" || b["class"] == "strangermsg")) {
  45. let stamp = new window.Timestamp$Element("span", clone({"class": "timestamp"}));
  46. stamp.appendText(new Date().toISOString().replace(/T|\..*|Z/g, " "));
  47. elem.grab(stamp);
  48. }
  49. return elem;
  50. });
  51.  
  52. Object.assign(window.Element, window.Timestamp$Element);
  53. }
  54.  
  55. begin();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement