1
1
// Diff2Html minifier version (automatically generated)
2
- var global = this ;
2
+ /*
3
+ * Hack to allow nodejs require("package/file") in the browser
4
+ * How?
5
+ * Since every require is used as an object:
6
+ * `require("./utils.js").Utils` // (notice the `.Utils`)
7
+ *
8
+ * We can say that when there is no require method
9
+ * we use the global object in which the `Utils`
10
+ * object was already injected.
11
+ */
12
+
13
+ var $globalHolder = ( typeof module !== 'undefined' && module . exports ) ||
14
+ ( typeof exports !== 'undefined' && exports ) ||
15
+ ( typeof window !== 'undefined' && window ) ||
16
+ ( typeof self !== 'undefined' && self ) ||
17
+ ( typeof this !== 'undefined' && this ) ||
18
+ Function ( 'return this' ) ( ) ;
3
19
function require ( ) {
4
- return global ;
5
- } /* See LICENSE file for terms of use */
20
+ return $globalHolder ;
21
+ }
22
+ /* See LICENSE file for terms of use */
6
23
7
24
/*
8
25
* Text diff implementation.
@@ -652,7 +669,7 @@ function require() {
652
669
*
653
670
*/
654
671
655
- ( function ( global , undefined ) {
672
+ ( function ( ctx , undefined ) {
656
673
657
674
function Utils ( ) {
658
675
}
@@ -673,11 +690,13 @@ function require() {
673
690
return value ? value : "" ;
674
691
} ;
675
692
676
- if ( typeof module !== 'undefined' && module . exports ) {
677
- module . exports . Utils = new Utils ( ) ;
678
- } else if ( typeof global . Utils === 'undefined' ) {
679
- global . Utils = new Utils ( ) ;
680
- }
693
+ // expose this module
694
+ ( ( typeof module !== 'undefined' && module . exports ) ||
695
+ ( typeof exports !== 'undefined' && exports ) ||
696
+ ( typeof window !== 'undefined' && window ) ||
697
+ ( typeof self !== 'undefined' && self ) ||
698
+ ( typeof $this !== 'undefined' && $this ) ||
699
+ Function ( 'return this' ) ( ) ) [ "Utils" ] = new Utils ( ) ;
681
700
682
701
} ) ( this ) ;
683
702
/*
@@ -687,7 +706,7 @@ function require() {
687
706
*
688
707
*/
689
708
690
- ( function ( global , undefined ) {
709
+ ( function ( ctx , undefined ) {
691
710
692
711
var utils = require ( "./utils.js" ) . Utils ;
693
712
@@ -895,11 +914,13 @@ function require() {
895
914
else return language ;
896
915
}
897
916
898
- if ( typeof module !== 'undefined' && module . exports ) {
899
- module . exports . DiffParser = new DiffParser ( ) ;
900
- } else if ( typeof global . DiffParser === 'undefined' ) {
901
- global . DiffParser = new DiffParser ( ) ;
902
- }
917
+ // expose this module
918
+ ( ( typeof module !== 'undefined' && module . exports ) ||
919
+ ( typeof exports !== 'undefined' && exports ) ||
920
+ ( typeof window !== 'undefined' && window ) ||
921
+ ( typeof self !== 'undefined' && self ) ||
922
+ ( typeof $this !== 'undefined' && $this ) ||
923
+ Function ( 'return this' ) ( ) ) [ "DiffParser" ] = new DiffParser ( ) ;
903
924
904
925
} ) ( this ) ;
905
926
/*
@@ -909,12 +930,10 @@ function require() {
909
930
*
910
931
*/
911
932
912
- ( function ( global , undefined ) {
933
+ ( function ( ctx , undefined ) {
913
934
914
935
// dirty hack for browser compatibility
915
- var jsDiff = ( typeof JsDiff !== "undefined" && JsDiff ) ||
916
- require ( "diff" ) ||
917
- require ( "../lib/diff.js" ) ;
936
+ var jsDiff = ( typeof JsDiff !== "undefined" && JsDiff ) || require ( "diff" ) ;
918
937
var utils = require ( "./utils.js" ) . Utils ;
919
938
920
939
function PrinterUtils ( ) {
@@ -988,11 +1007,13 @@ function require() {
988
1007
return line . replace ( / ( < d e l > ( ( .| \n ) * ?) < \/ d e l > ) / g, "" ) ;
989
1008
}
990
1009
991
- if ( typeof module !== 'undefined' && module . exports ) {
992
- module . exports . PrinterUtils = new PrinterUtils ( ) ;
993
- } else if ( typeof global . PrinterUtils === 'undefined' ) {
994
- global . PrinterUtils = new PrinterUtils ( ) ;
995
- }
1010
+ // expose this module
1011
+ ( ( typeof module !== 'undefined' && module . exports ) ||
1012
+ ( typeof exports !== 'undefined' && exports ) ||
1013
+ ( typeof window !== 'undefined' && window ) ||
1014
+ ( typeof self !== 'undefined' && self ) ||
1015
+ ( typeof $this !== 'undefined' && $this ) ||
1016
+ Function ( 'return this' ) ( ) ) [ "PrinterUtils" ] = new PrinterUtils ( ) ;
996
1017
997
1018
} ) ( this ) ;
998
1019
/*
@@ -1002,7 +1023,7 @@ function require() {
1002
1023
*
1003
1024
*/
1004
1025
1005
- ( function ( global , undefined ) {
1026
+ ( function ( ctx , undefined ) {
1006
1027
1007
1028
var diffParser = require ( "./diff-parser.js" ) . DiffParser ;
1008
1029
var printerUtils = require ( "./printer-utils.js" ) . PrinterUtils ;
@@ -1183,11 +1204,13 @@ function require() {
1183
1204
return fileHtml ;
1184
1205
}
1185
1206
1186
- if ( typeof module !== 'undefined' && module . exports ) {
1187
- module . exports . SideBySidePrinter = new SideBySidePrinter ( ) ;
1188
- } else if ( typeof global . SideBySidePrinter === 'undefined' ) {
1189
- global . SideBySidePrinter = new SideBySidePrinter ( ) ;
1190
- }
1207
+ // expose this module
1208
+ ( ( typeof module !== 'undefined' && module . exports ) ||
1209
+ ( typeof exports !== 'undefined' && exports ) ||
1210
+ ( typeof window !== 'undefined' && window ) ||
1211
+ ( typeof self !== 'undefined' && self ) ||
1212
+ ( typeof $this !== 'undefined' && $this ) ||
1213
+ Function ( 'return this' ) ( ) ) [ "SideBySidePrinter" ] = new SideBySidePrinter ( ) ;
1191
1214
1192
1215
} ) ( this ) ;
1193
1216
/*
@@ -1197,7 +1220,7 @@ function require() {
1197
1220
*
1198
1221
*/
1199
1222
1200
- ( function ( global , undefined ) {
1223
+ ( function ( ctx , undefined ) {
1201
1224
1202
1225
var diffParser = require ( "./diff-parser.js" ) . DiffParser ;
1203
1226
var printerUtils = require ( "./printer-utils.js" ) . PrinterUtils ;
@@ -1342,11 +1365,13 @@ function require() {
1342
1365
"</tr>\n" ;
1343
1366
}
1344
1367
1345
- if ( typeof module !== 'undefined' && module . exports ) {
1346
- module . exports . LineByLinePrinter = new LineByLinePrinter ( ) ;
1347
- } else if ( typeof global . LineByLinePrinter === 'undefined' ) {
1348
- global . LineByLinePrinter = new LineByLinePrinter ( ) ;
1349
- }
1368
+ // expose this module
1369
+ ( ( typeof module !== 'undefined' && module . exports ) ||
1370
+ ( typeof exports !== 'undefined' && exports ) ||
1371
+ ( typeof window !== 'undefined' && window ) ||
1372
+ ( typeof self !== 'undefined' && self ) ||
1373
+ ( typeof $this !== 'undefined' && $this ) ||
1374
+ Function ( 'return this' ) ( ) ) [ "LineByLinePrinter" ] = new LineByLinePrinter ( ) ;
1350
1375
1351
1376
} ) ( this ) ;
1352
1377
/*
@@ -1356,7 +1381,7 @@ function require() {
1356
1381
*
1357
1382
*/
1358
1383
1359
- ( function ( global , undefined ) {
1384
+ ( function ( ctx , undefined ) {
1360
1385
1361
1386
var lineByLinePrinter = require ( "./line-by-line-printer.js" ) . LineByLinePrinter ;
1362
1387
var sideBySidePrinter = require ( "./side-by-side-printer.js" ) . SideBySidePrinter ;
@@ -1368,23 +1393,23 @@ function require() {
1368
1393
1369
1394
HtmlPrinter . prototype . generateSideBySideJsonHtml = sideBySidePrinter . generateSideBySideJsonHtml ;
1370
1395
1371
- if ( typeof module !== 'undefined' && module . exports ) {
1372
- module . exports . HtmlPrinter = new HtmlPrinter ( ) ;
1373
- } else if ( typeof global . HtmlPrinter === 'undefined' ) {
1374
- global . HtmlPrinter = new HtmlPrinter ( ) ;
1375
- }
1396
+ // expose this module
1397
+ ( ( typeof module !== 'undefined' && module . exports ) ||
1398
+ ( typeof exports !== 'undefined' && exports ) ||
1399
+ ( typeof window !== 'undefined' && window ) ||
1400
+ ( typeof self !== 'undefined' && self ) ||
1401
+ ( typeof $this !== 'undefined' && $this ) ||
1402
+ Function ( 'return this' ) ( ) ) [ "HtmlPrinter" ] = new HtmlPrinter ( ) ;
1376
1403
1377
1404
} ) ( this ) ;
1378
1405
/*
1379
1406
*
1380
1407
* Diff to HTML (diff2html.js)
1381
1408
* Author: rtfpessoa
1382
1409
*
1383
- * Diff commands:
1384
- * git diff
1385
1410
*/
1386
1411
1387
- ( function ( global , undefined ) {
1412
+ ( function ( ctx , undefined ) {
1388
1413
1389
1414
var diffParser = require ( "./diff-parser.js" ) . DiffParser ;
1390
1415
var htmlPrinter = require ( "./html-printer.js" ) . HtmlPrinter ;
@@ -1393,13 +1418,12 @@ function require() {
1393
1418
}
1394
1419
1395
1420
/*
1396
- * config
1397
- * {
1398
- * "wordByWord" : true (default)
1399
- * OR
1400
- * "charByChar" : true
1401
- * }
1402
- *
1421
+ * Line diff type configuration
1422
+ var config = {
1423
+ "wordByWord": true, // (default)
1424
+ // OR
1425
+ "charByChar": true
1426
+ };
1403
1427
*/
1404
1428
1405
1429
/*
@@ -1444,10 +1468,12 @@ function require() {
1444
1468
return htmlPrinter . generateSideBySideJsonHtml ( diffJson , configOrEmpty ) ;
1445
1469
} ;
1446
1470
1447
- if ( typeof module !== 'undefined' && module . exports ) {
1448
- module . exports . Diff2Html = new Diff2Html ( ) ;
1449
- } else if ( typeof global . Diff2Html === 'undefined' ) {
1450
- global . Diff2Html = new Diff2Html ( ) ;
1451
- }
1471
+ // expose this module
1472
+ ( ( typeof module !== 'undefined' && module . exports ) ||
1473
+ ( typeof exports !== 'undefined' && exports ) ||
1474
+ ( typeof window !== 'undefined' && window ) ||
1475
+ ( typeof self !== 'undefined' && self ) ||
1476
+ ( typeof $this !== 'undefined' && $this ) ||
1477
+ Function ( 'return this' ) ( ) ) [ "Diff2Html" ] = new Diff2Html ( ) ;
1452
1478
1453
1479
} ) ( this ) ;
0 commit comments