Sections
Timeline
Sub-Sections
Next Change →
Download
Unified Diff
Zip Archive
Metanav
Preferences
About Trac
Links
Slowchop Studios
Gerald Kaszuba
Advertisement

Changeset 12 for human-readable-json

Show
Ignore:
Timestamp:
29/08/07 22:22:42 (17 months ago)
Author:
gak
Message:

fixed javascript error

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • human-readable-json/human-readable-json.user.js

    r11 r12  
    1 // Human Readable JSON Greasemonkey Script v0.1.0 
     1// Human Readable JSON Greasemonkey Script v0.1.1 
    22// Copyright 2007 Gerald Kaszuba 
    33// Released under the GPL license 
     
    151151    'load',  
    152152    function() { 
    153             jsonTag = document.getElementsByTagName('pre')[0] 
    154             jsonText = jsonTag.textContent; 
    155             jsonObj = jsonText.parseJSON(); 
    156             prettyJson = jsonObj.toJSONString(true); 
    157             jsonTag.textContent = prettyJson; 
     153        jsonTag = document.getElementsByTagName('pre')[0]; 
     154        if (!jsonTag) return; 
     155        jsonText = jsonTag.textContent; 
     156        jsonObj = jsonText.parseJSON(); 
     157        prettyJson = jsonObj.toJSONString(true); 
     158        jsonTag.textContent = prettyJson; 
    158159    }, 
    159160    true); 
    160161 
     162// vim: ts=4 sw=4 expandtab