Advertisement
thetenfold

uso-admin-menu_revision3

Jul 8th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function name() { // anonymous function wrapper, used for error checking to end execution
  2. 'use strict';
  3.  
  4. // declare variables
  5. var admin, scriptID, extra, div, i;
  6.  
  7. if(window.self !== window.top) return; // end execution if in a frame
  8.  
  9. // get the "Admin" link's href
  10. admin = document.evaluate("//a[.='Admin' and @class='admin']/@href", document, null, 2, null).stringValue;
  11.  
  12. // quit if the admin link is not found
  13. if(admin === "") return;
  14.  
  15. // grab the script's ID
  16. scriptID = admin.match(/\/(\d+)/)[1];
  17.  
  18. // define the new links to be added
  19. extra = {
  20.     'Edit Metadata' : '/scripts/edit/' ,
  21.     'Edit Code' : '/scripts/edit_src/',
  22.     'Upload New Version' : '/scripts/upload/' ,
  23.     'Screenshots & Icon' : '/scripts/images/' ,
  24. }
  25.  
  26. // create a holder for the links
  27. div = document.createElement('div');
  28. div.setAttribute('style', 'color: #00f; margin-top: 6px;');
  29. div.innerHTML = '<b>Admin:</b>&nbsp;&nbsp; ';
  30.  
  31. // add the new links to the holder
  32. for (i in extra) {
  33.     div.innerHTML += '&bull; <a href="'+ extra[i] + scriptID + '" style="text-decoration: none !important; color: #c00; margin-right: 6px;">' + i + '</a> ';
  34. }
  35.  
  36. // add the holder containing the links to the page
  37. document.getElementById('details').appendChild(div);
  38.  
  39. })(); // end of anonymous function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement