samedi 30 mai 2015

Get script's own source from Greasemonkey script

I know that with basic JS you can read a <script>'s source code like so:

<pre id="scriptContents"></pre>
<script id="myScript" type="text/javascript">
  var script = document.getElementById('myScript');
  var contents = script.innerHTML;
  scriptContents.innerText = contents;
</script>

So my question is: Is there any way similar to this in Greasemonkey/Tampermonkey? I want to be able to read the Greasmonkey script's source code as string.

The reason I'm asking is because the Greasemonkey script is magically included to the page and doesn't have a "physical" representation like the above <script> block.





Aucun commentaire:

Enregistrer un commentaire