reusability - Use a userscript as a regular javascript? -
if have userscript i've found online, , i'd incorporate website normal javascript (i.e. not userscript), how can that?
this seems pretty simple new javascript , userscript, can me out.
for example, found userscript: "convert ups , fedex tracking numbers links"...
which parse page regular expressions matching ups/fedex/usps tracking number, , convert them links respective carriers' tracking website track number.
this works great userscript, automatic on site working on (not require visitors download/install userscript).
how can use userscript regular javascript?
userscripts executed after page dom loaded, make sure page contents can accessed. so, need kind of mechanism achieve that. bit tricky since older versions of ie need special treatment.
doing manually require 30 lines of code. libraries jquery offer ready()
method so:
<script src="http://code.jquery.com/jquery-latest.min.js"></script> <script> $(document).ready(function () { // put userscript here }); </script>
Comments
Post a Comment