Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 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. // USAGE:
  10. // 0. Save this script as findface.user.js
  11. // 1. Download greasemonkey (firefox) or tempermonkey (chrome)
  12. // 2. Install the script ( just open it in browser )
  13. // 3. Do a search as usual
  14. // 4. Refresh the page
  15.  
  16. // Note that you can use it in chrome without tempermonkey, just drag and drop it into extension's page
  17. // It is better to use chrome, firefox may hang badly
  18.  
  19. function startDrag(e)
  20. {
  21. // determine event object
  22. if (!e) {
  23. var e = window.event;
  24. }
  25.  
  26. // IE uses srcElement, others use target
  27. var targ = e.target ? e.target : e.srcElement;
  28.  
  29. if (targ.className != 'dragme') {
  30. return;
  31. }
  32.  
  33. // calculate event X, Y coordinates
  34. offsetX = e.clientX;
  35. offsetY = e.clientY;
  36.  
  37. // assign default values for top and left properties
  38. if(!targ.style.right) { targ.style.right ='0px'};
  39. if(!targ.style.bottom) { targ.style.bottom ='0px'};
  40.  
  41. // calculate integer values for top and left
  42. // properties
  43. coordX = parseInt(targ.style.right);
  44. coordY = parseInt(targ.style.bottom);
  45.  
  46. drag = true;
  47.  
  48. // move div element
  49. document.onmousemove = dragDiv;
  50. return false;
  51. }
  52.  
  53. function dragDiv(e) {
  54.  
  55. if (!drag) {
  56. return;
  57. }
  58.  
  59. if (!e) {
  60. var e= window.event;
  61. }
  62.  
  63. var targ = e.target ? e.target : e.srcElement;
  64.  
  65. // move div element
  66. targ.style.right = coordX - e.clientX + offsetX + 'px';
  67. targ.style.bottom = coordY - e.clientY + offsetY + 'px';
  68.  
  69. document.onmousemove = dragDiv;
  70.  
  71. return false;
  72. }
  73.  
  74. function stopDrag() {
  75. drag = false;
  76. }
  77.  
  78. function main()
  79. {
  80. document.body.innerHTML = "";
  81. document.body.style.overflowY = 'scroll';
  82. document.body.style.overflowX = 'scroll';
  83.  
  84. var str = startDrag.toString() + stopDrag.toString() + stopDrag();
  85. var script = document.createElement('script');
  86. script.appendChild(document.createTextNode(str));
  87. (document.body || document.head || document.documentElement).appendChild(script);
  88.  
  89. var pic = document.createElement('img');
  90. pic.src = localStorage.getItem('FF.searchFacePhoto').slice(1, -1);
  91. pic.className = 'dragme';
  92. pic.style.position = 'fixed';
  93. pic.style.right = 0;
  94. pic.style.bottom = 0;
  95.  
  96. document.body.appendChild(pic);
  97. document.onmousedown = startDrag;
  98. document.onmouseup = stopDrag;
  99.  
  100. var usrlist = JSON.parse(localStorage.getItem('FF.usersSearchList'));
  101.  
  102. usrlist.forEach(function(e){
  103.  
  104. var id = e.user_id.toString();
  105.  
  106. document.body.innerHTML += "<h1><a href='https://vk.com/id" + id + "'>" + "vk.com/id" + id + " ( " + e.first_name + " " + e.last_name + " )</a></h1>";
  107.  
  108. var len = e.photos.length;
  109. for(var i = 0; i < len; i++){
  110. var crop = e.photos[i];
  111. var full = "";
  112.  
  113. if(crop.startsWith("http://cropper")){
  114. var begin = crop.indexOf('=') + 1;
  115. var end = crop.indexOf('&');
  116.  
  117. full = crop.substring(begin, end);
  118. } else {
  119. full = crop;
  120. }
  121.  
  122. document.body.innerHTML += "<a href='" + full + "'><img src='" + crop + "'></a>";
  123. }
  124. document.body.innerHTML += "<br><br><br>";
  125. });
  126. }
  127.  
  128. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement