Advertisement
Guest User

Untitled

a guest
Apr 27th, 2016
1,577
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. // ==UserScript==
  2. // @name findface_list
  3. // @namespace findface_list
  4. // @include http://findface.ru/search-result
  5. // @version 1
  6. // @grant none
  7. // ==/UserScript==
  8.  
  9. function startDrag(e)
  10. {
  11. // determine event object
  12. if (!e) {
  13. var e = window.event;
  14. }
  15.  
  16. // IE uses srcElement, others use target
  17. var targ = e.target ? e.target : e.srcElement;
  18.  
  19. if (targ.className != 'dragme') {
  20. return;
  21. }
  22.  
  23. // calculate event X, Y coordinates
  24. offsetX = e.clientX;
  25. offsetY = e.clientY;
  26.  
  27. // assign default values for top and left properties
  28. if(!targ.style.right) { targ.style.right ='0px'};
  29. if(!targ.style.bottom) { targ.style.bottom ='0px'};
  30.  
  31. // calculate integer values for top and left
  32. // properties
  33. coordX = parseInt(targ.style.right);
  34. coordY = parseInt(targ.style.bottom);
  35.  
  36. drag = true;
  37.  
  38. // move div element
  39. document.onmousemove = dragDiv;
  40. return false;
  41. }
  42.  
  43. function dragDiv(e) {
  44.  
  45. if (!drag) {
  46. return;
  47. }
  48.  
  49. if (!e) {
  50. var e= window.event;
  51. }
  52.  
  53. var targ = e.target ? e.target : e.srcElement;
  54.  
  55. // move div element
  56. targ.style.right = coordX - e.clientX + offsetX + 'px';
  57. targ.style.bottom = coordY - e.clientY + offsetY + 'px';
  58.  
  59. document.onmousemove = dragDiv;
  60.  
  61. return false;
  62. }
  63.  
  64. function stopDrag() {
  65. drag = false;
  66. }
  67.  
  68. function main()
  69. {
  70. document.body.innerHTML = "";
  71. document.body.style.overflowY = 'scroll';
  72.  
  73. var str = startDrag.toString() + stopDrag.toString() + stopDrag();
  74. var script = document.createElement('script');
  75. script.appendChild(document.createTextNode(str));
  76. (document.body || document.head || document.documentElement).appendChild(script);
  77.  
  78. var pic = document.createElement('img');
  79. pic.src = localStorage.getItem('FF.searchFacePhoto').slice(1, -1);
  80. pic.className = 'dragme';
  81. pic.style.position = 'fixed';
  82. pic.style.right = 0;
  83. pic.style.bottom = 0;
  84.  
  85. document.body.appendChild(pic);
  86. document.onmousedown = startDrag;
  87. document.onmouseup = stopDrag;
  88.  
  89. var usrlist = JSON.parse(localStorage.getItem('FF.usersSearchList'));
  90.  
  91. usrlist.forEach(function(e){
  92.  
  93. var id = e.user_id.toString();
  94.  
  95. document.body.innerHTML += "<h1><a href='https://vk.com/id" + id + "'>" + "vk.com/id" + id + "</a> ( " + e.first_name + " " + e.last_name + " )</h1>";
  96.  
  97. var len = e.photos.length;
  98. for(var i = 0; i < len; i++){
  99. var crop = e.photos[i];
  100. var full = "";
  101.  
  102. if(crop.startsWith("http://cropper")){
  103. var begin = crop.indexOf('=') + 1;
  104. var end = crop.indexOf('&');
  105.  
  106. full = crop.substring(begin, end);
  107. } else {
  108. full = crop;
  109. }
  110.  
  111. document.body.innerHTML += "<a href='" + full + "'><img src='" + crop + "'></a>";
  112. }
  113. document.body.innerHTML += "<br><br><br>";
  114. });
  115. }
  116.  
  117. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement