Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name USO Admin Menu
- // @namespace erosman
- // @description Adds Admin links to the Script Menu
- // @updateURL https://userscripts.org/scripts/source/172766.meta.js
- // @downloadURL https://userscripts.org/scripts/source/172766.user.js
- // @include http://userscripts.org/scripts/*
- // @include https://userscripts.org/scripts/*
- // @include http://userscripts.org/topics/*
- // @include https://userscripts.org/topics/*
- // @grant none
- // @author erosman
- // @version 1.2
- // ==/UserScript==
- /* --------- Note ---------
- This script adds Admin links to the Script Menu
- I have minimised the styling in order to avoid using GM_addStyle
- --------- History ---------
- 1.2 New code + New Style + Added topic pages + More Admin links
- 1.1 Fixed the @updateURL & @downloadURL error
- 1.0 Initial release
- */
- (function name() { // anonymous function wrapper, used for error checking to end execution
- 'use strict';
- var elements = undefined,
- scriptID = undefined,
- extra = undefined,
- div = undefined,
- i = undefined;
- if (window.self !== window.top) { return; } // end execution if in a frame
- elements = document.getElementsByClassName('admin');
- if (!elements[0] || elements[0].innerHTML !== 'Admin') { return; } // end execution
- // get script ID --- this method is 10x faster than elements[0].href.match(/\d+$/) on Firefox
- scriptID = elements[0].href.substr(elements[0].href.lastIndexOf('/') + 1);
- extra = {
- 'Edit Metadata' : '/scripts/edit/' ,
- 'Edit Code' : '/scripts/edit_src/',
- 'Upload New Version' : '/scripts/upload/' ,
- 'Screenshots & Icon' : '/scripts/images/' ,
- }
- div = document.createElement('div');
- div.setAttribute('style', 'color: #00f;');
- div.innerHTML = '<b>Admin:</b> ';
- for (i in extra) {
- div.innerHTML +=
- '• <a href="'+ extra[i] + scriptID + '" style="text-decoration: none; color: #c00;">' + i + '</a> ';
- }
- document.getElementById('details').appendChild(div);
- })(); // end of anonymous function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement