Advertisement
MadManMarkAu

E621 javascript - convert preview/sample images to full res

Feb 10th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This snippet automatically converts any e621.net sample and preview image links into their full resolution when opened.
  2. // Use Chrome plugin "Custom JavaScript for Websites 2"
  3. // Include jQuery 3.2.1 in definition
  4.  
  5. function searchRedirect() {
  6.     var loc = window.location.pathname;
  7.     var md5 = false;
  8.     if (loc.startsWith('/data/sample/')) {
  9.         md5 = loc.substring(19, 19+32);
  10.     } else if (loc.startsWith('/data/preview/')) {
  11.         md5 = loc.substring(20, 20+32);
  12.     }
  13.    
  14.     if (md5) {
  15.         $.ajax({url: 'https://e621.net/post/show.json?md5=' + md5,
  16.         dataType: 'jsonp',
  17.         crossDomain: true,
  18.         success: function(data) {
  19.             window.location.replace(data.file_url);
  20.         }});
  21.     }
  22. }
  23.  
  24. searchRedirect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement