Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 2281594

Browse files
author
mikesamuel@gmail.com
committed
fix for autoloader in FF3 which does not have document.scripts courtesy bknovell
1 parent 96f2739 commit 2281594

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

README.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<link href="src/prettify.css" type="text/css" rel="stylesheet" />
99

1010
<script src="src/prettify.js" type="text/javascript"></script>
11+
<script src="src/lang-css.js" type="text/javascript"></script>
1112

1213
<style type="text/css">
1314
body { margin-left: .5in }
@@ -223,11 +224,28 @@ <h3>I can't add classes to my code (because it comes from Markdown, etc.)</h3>
223224
<code>&lt;?prettify ...?&gt;</code> works as explained in
224225
<a href="http://code.google.com/p/google-code-prettify/wiki/GettingStarted">Getting Started</a></p>
225226

227+
<h3>How can I put line numbers on every line instead of just every
228+
fifth line?</h3>
229+
230+
<p>Prettify puts lines into an HTML list element so that line
231+
numbers aren't caught by copy/paste, and the line numbering is
232+
controlled by CSS in the default stylesheet, "prettify.css".</p>
233+
234+
<pre class="prettyprint lang-css">
235+
&lt;style&gt;
236+
li.L0, li.L1, li.L2, li.L3,
237+
li.L5, li.L6, li.L7, li.L8
238+
{ list-style-type: decimal !important }
239+
&lt;/style&gt;
240+
</pre>
241+
242+
should turn line numbering back on for the other lines.
243+
226244
<br><br><br>
227245

228246
<div class="footer">
229247
<!-- Created: Tue Oct 3 17:51:56 PDT 2006 -->
230-
<!-- hhmts start -->Last modified: Wed May 15 16:35:48 EDT 2013 <!-- hhmts end -->
248+
<!-- hhmts start -->Last modified: Fri Jun 21 15:14:20 EDT 2013 <!-- hhmts end -->
231249
</div>
232250
</body>
233251
</html>

js-modules/run_prettify.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@
134134
// This starts looking at the end instead of just considering the last
135135
// because deferred and async scripts run out of order.
136136
// If the script is loaded twice, then this will run in reverse order.
137-
for (var scripts = doc.scripts, i = scripts.length; --i >= 0;) {
137+
var scripts = doc.getElementsByTagName('script');
138+
for (var i = scripts.length; --i >= 0;) {
138139
var script = scripts[i];
139140
var match = script.src.match(
140141
/^[^?#]*\/run_prettify\.js(\?[^#]*)?(?:#.*)?$/);

src/run_prettify.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ var IN_GLOBAL_SCOPE = false;
138138
// This starts looking at the end instead of just considering the last
139139
// because deferred and async scripts run out of order.
140140
// If the script is loaded twice, then this will run in reverse order.
141-
for (var scripts = doc.scripts, i = scripts.length; --i >= 0;) {
141+
var scripts = doc.getElementsByTagName('script');
142+
for (var i = scripts.length; --i >= 0;) {
142143
var script = scripts[i];
143144
var match = script.src.match(
144145
/^[^?#]*\/run_prettify\.js(\?[^#]*)?(?:#.*)?$/);

0 commit comments

Comments
 (0)