Advertisement
thetenfold

USO_enable-disabled-usocheckup-require

Jun 11th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        USO - Enable disabled usocheckup require
  3. // @namespace   http://userscripts.org/users/23652
  4. // @description Enables the disabled @require of usocheckup when updating/uploading source code on Userscripts.org
  5. // @include     http://userscripts.org/scripts/new?form=true
  6. // @include     http://userscripts.org/scripts/edit_src/*
  7. // @copyright   JoeSimmons
  8. // @version     1.0.0
  9. // @license     http://creativecommons.org/licenses/by-nc-nd/3.0/us/
  10. // ==/UserScript==
  11.  
  12. (function() {
  13.  
  14.     var enableUpdater = function() {
  15.  
  16.         var regex = /\/\/@require(\s+http:\/\/usocheckup)/m, textarea = document.evaluate("//textarea[@id='script_src']", document, null, 9, null).singleNodeValue;
  17.  
  18.         if(regex.test(textarea.value)) {
  19.             textarea.value = textarea.value.replace(regex, "// @require$1");
  20.         }
  21.  
  22.     },
  23.     button = document.evaluate("//input[@type='submit' and @name='commit' and @value]", document, null, 9, null).singleNodeValue;
  24.  
  25.     if(button !== null) {
  26.         button.addEventListener("click", enableUpdater, false);
  27.     }
  28.  
  29. }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement