@@ -7,7 +7,7 @@ var renderAlert = require('./viewer/render-alert');
77var getOptions = require ( './viewer/get-options' ) ;
88var loadRequiredCss = require ( './viewer/load-required-css' ) ;
99
10- function oversizedJSON ( pre , options ) {
10+ function oversizedJSON ( pre , options , outsideViewer ) {
1111 var jsonSize = pre . textContent . length ;
1212 var accepted = options . addons . maxJsonSize ;
1313
@@ -27,10 +27,26 @@ function oversizedJSON(pre, options) {
2727 "Accepted: " + accepted + " kbytes, received: " + loaded + " kbytes. " +
2828 "It's possible to change this value at options -> Add-ons -> maxJsonSize"
2929 ) ;
30- renderAlert ( pre , options ,
31- "[JSONViewer] Content not highlighted due to oversize. " +
32- "Take a look at the console log for more information."
33- ) ;
30+
31+ var container = document . createElement ( "div" ) ;
32+
33+ var message = document . createElement ( "div" ) ;
34+ message . innerHTML = "[JSONViewer] Content not highlighted due to oversize. " +
35+ "Take a look at the console log for more information." ;
36+ container . appendChild ( message ) ;
37+
38+ var highlightAnyway = document . createElement ( "a" ) ;
39+ highlightAnyway . href = "#" ;
40+ highlightAnyway . title = "Highlight anyway!" ;
41+ highlightAnyway . innerHTML = "Highlight anyway!" ;
42+ highlightAnyway . onclick = function ( e ) {
43+ e . preventDefault ( ) ;
44+ pre . hidden = true ;
45+ highlightContent ( pre , outsideViewer , true ) ;
46+ }
47+ container . appendChild ( highlightAnyway ) ;
48+
49+ renderAlert ( pre , options , container ) ;
3450 }
3551
3652 return isOversizedJSON ;
@@ -46,9 +62,9 @@ function prependHeader(options, outsideViewer, jsonText) {
4662 return jsonText ;
4763}
4864
49- function highlightContent ( pre , outsideViewer ) {
65+ function highlightContent ( pre , outsideViewer , ignoreLimit ) {
5066 getOptions ( ) . then ( function ( options ) {
51- if ( oversizedJSON ( pre , options ) ) {
67+ if ( ! ignoreLimit && oversizedJSON ( pre , options , outsideViewer ) ) {
5268 return pre . hidden = false ;
5369 }
5470
0 commit comments