-
Notifications
You must be signed in to change notification settings - Fork 12
/
PackJS.pas
137 lines (123 loc) · 5.08 KB
/
PackJS.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
unit PackJS;
interface
uses
Interfaces,
Classes;
type
TPackJS = class(TInterfacedObject,iModelJS)
private
FPack : TStringList;
FCDN : Boolean;
public
constructor Create;
destructor Destroy; override;
class function New : iModelJS;
function PackJS : String;
function CDN(Value : Boolean) : iModelJS;
end;
implementation
uses
SysUtils,
BootstrapJS,
ChartbundleJS,
FontawesomeallJS,
JqueryJS,
PopperJS,
TetherminJS,
UtilsJS,
NumberJS,
DataTableJS,
Chart.Easy.PieJS,
Chart.Easy.PieCSS,
PivotTableJS,
JQuery.UIJS,
PivotTablePlotlyJS, PivotTablePlotlyRendersJS, MomentJS, ChartStreamJS;
{ TPackJS }
function TPackJS.CDN(Value: Boolean): iModelJS;
begin
Result := Self;
FCDN := Value;
end;
constructor TPackJS.Create;
begin
FPack := TStringList.Create;
FCDN := False;
end;
destructor TPackJS.Destroy;
begin
freeandnil(fpack);
inherited;
end;
class function TPackJS.New: iModelJS;
begin
Result := Self.Create;
end;
function TPackJS.PackJS : String;
begin
if FCDN then
begin
Result := Result + '<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>';
Result := Result + '<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>';
Result := Result + '<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>';
Result := Result + '<script src="https://kit.fontawesome.com/b9e0a0bfd1.js" crossorigin="anonymous"></script>';
Result := Result + '<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/jq-3.3.1/dt-1.10.20/r-2.2.3/sl-1.3.1/datatables.min.js"></script>';
Result := Result + '<script src="https://cdnjs.cloudflare.com/ajax/libs/easy-pie-chart/2.1.6/jquery.easypiechart.min.js"></script>';
Result := Result + '<script src="https://cdn.jsdelivr.net/npm/moment@2.24.0/min/moment.min.js"></script>';
Result := Result + '<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>';
Result := Result + '<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-streaming@1.8.0"></script>';
Result := Result + '<script src="https://cdnjs.cloudflare.com/ajax/libs/numeral.js/2.0.6/numeral.min.js"></script>';
Result := Result + '<script type="text/javascript" src="https://pivottable.js.org/dist/pivot.js"></script>';
Result := Result + '<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>';
Result := Result + '<script src="https://cdn.plot.ly/plotly-basic-latest.min.js"></script>';
Result := Result + '<script type="text/javascript" src="https://pivottable.js.org/dist/plotly_renderers.js"></script>';
Result := Result + '<script>';
Result := Result + '(function (global, factory) {';
Result := Result + ' if (typeof define === ''function'' && define.amd) {';
Result := Result + ' define([''../numeral''], factory);';
Result := Result + ' } else if (typeof module === ''object'' && module.exports) {';
Result := Result + ' factory(require(''../numeral''));';
Result := Result + ' } else {';
Result := Result + ' factory(global.numeral);';
Result := Result + ' }';
Result := Result + '}(this, function (numeral) {';
Result := Result + ' numeral.register(''locale'', ''pt-br'', {';
Result := Result + ' delimiters: {';
Result := Result + ' thousands: ''.'',';
Result := Result + ' decimal: '',''';
Result := Result + ' },';
Result := Result + ' abbreviations: {';
Result := Result + ' thousand: ''mil'',';
Result := Result + ' million: ''milhões'',';
Result := Result + ' billion: ''b'',';
Result := Result + ' trillion: ''t''';
Result := Result + ' },';
Result := Result + ' ordinal: function (number) {';
Result := Result + ' return ''º'';';
Result := Result + ' },';
Result := Result + ' currency: {';
Result := Result + ' symbol: ''R$''';
Result := Result + ' }';
Result := Result + ' });';
Result := Result + '}));';
Result := Result + '</script>';
end
else
Result := FPack.Text+
TBootstrapJS.New.PackJS+
TFontawesomeallJS.New.PackJS+
TJqueryJS.New.PackJS+
TPopperJS.New.PackJS+
TTetherminJS.New.PackJS+
TUtilsJS.New.PackJS+
TNumberJS.New.PackJS+
TDataTableJS.New.PackJS+
TChartEasyPieJS.New.PackJS+
TMomentJs.New.PackJS+
TChartbundleJS.New.PackJS+
TChartStreamJS.New.PackJS+
TPivotTableJS.New.PackJS+
TJQueryUIJS.New.PackJS+
TPivotTablePlotlyJS.New.PackJS+
TPivotTablePlotlyRendersJs.New.PackJS;
end;
end.