Category:Code snippets: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m (Verbage for Core samp changed a bit to clarify.)
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
List of pages with code snippets. Browse around, you might learn something new.
List of pages with code snippets. Browse around, you might learn something new.


<pre>If you see code like this it is usually a Good sample but may not be verified.</pre>
<pre class='sample-bad'>
Code samples highlighted in red like this are bad ideas.
Usually, this code does not work, and the sample is to point out _that_ this code does not work.
</pre>


{{Core samp |1=<pre style="border: none; margin: inherit;">
<pre class='sample-good'>
If you see code like this it is usually a verified Core sample but may or may not be good practice.
Code samples highlighted in green, however, _do_ work.
This is typically only used in the Greasemonkey API to denote core samples.
They are usually presented beside the bad examples, as an idea what should be done instead.
 
</pre>
An example of where it may not be good practice is in the use of unsafeWindow.
</pre>}}
 
{{Good samp |1=<pre style="border: none; margin: inherit;">
If you see code like this it is usually a verified Good sample.
This is typically good practice in context.
</pre>}}
 
{{Fair samp |1=<pre style="border: none; margin: inherit;">
If you see code like this it is usually a verified Fair sample.
This may have some pitfalls and potential security risks but may still be useful in context.
</pre>}}
 
{{Bad samp |1=<pre style="border: none; margin: inherit;">
If you see code like this it is usually a verified Bad example.
This includes high security risks and/or not working in context.
</pre>}}

Latest revision as of 21:27, 3 February 2010

List of pages with code snippets. Browse around, you might learn something new.

Code samples highlighted in red like this are bad ideas.
Usually, this code does not work, and the sample is to point out _that_ this code does not work.
Code samples highlighted in green, however, _do_ work.
They are usually presented beside the bad examples, as an idea what should be done instead.

This category currently contains no pages or media.