Guest User

Untitled

a guest
Dec 10th, 2018
622
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. javascript:
  2. (function(){
  3. var head=document.getElementsByTagName('head')[0];
  4. var e=document.createElement('script');
  5. e.src='//crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha256.js';
  6. head.appendChild(e);
  7. e=document.createElement('style');
  8. e.innerHTML='.picpass-active {background:#aaffaa !important;z-index:10000}';
  9. head.appendChild(e);
  10. e=document.createElement('script');
  11. e.src='//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js';
  12. head.appendChild(e);
  13. var inter=setInterval(check,100);
  14. var runs=0;
  15. function check(){
  16. if(typeof jQuery!='undefined'){
  17. run();
  18. clearInterval(inter);
  19. }
  20. if(++runs>60){
  21. clearInterval(inter);
  22. }
  23. }
  24. function run(){
  25. var dropzone=$('input[type=password]');
  26. dropzone.css({'zIndex':10000});
  27. var dropped=null;
  28. var content=null;
  29. $('body').on('dragstart',function(e){if(e.srcElement.src){content=e.srcElement.src;}});
  30. dropzone.on('dragover',function(e){e.preventDefault();$(this).addClass('picpass-active');});
  31. dropzone.on('dragleave',function(e){e.preventDefault();$(this).removeClass('picpass-active');});
  32. dropzone.on('drop',function(e){dropped=$(this);e.stopPropagation();e.preventDefault();dropped.removeClass('picpass-active');processFiles(e.originalEvent.dataTransfer.files);});
  33. function processFiles(files){
  34. if(files&&typeof FileReader!=="undefined"&&files.length){
  35. readFile(files[0]);
  36. }
  37. else
  38. if(content){
  39. setValue(content);
  40. }
  41. }
  42. function setValue(v){
  43. var hash=CryptoJS.SHA256(v).toString();
  44. hash='!'+hash.substring(0,8).toUpperCase()+hash.substring(8);
  45. dropped.val(hash);
  46. }
  47. function readFile(file){
  48. var reader=new FileReader();
  49. reader.onload=function(e){
  50. setValue(e.target.result)
  51. }
  52. ;
  53. reader.readAsDataURL(file);
  54. }
  55. }
  56. }
  57. )()
Add Comment
Please, Sign In to add comment