cpee 2.0.17 → 2.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cockpit/css/wfadaptor.css +17 -0
- data/cockpit/js/instance.js +0 -1
- data/cockpit/js_libs.zip +0 -0
- data/cockpit/themes/model/rngs/call.rng +2 -1
- data/cockpit/themes/model/rngs/callmanipulate.rng +2 -1
- data/cockpit/themes/model/theme.js +1 -1
- data/cpee.gemspec +2 -2
- data/lib/cpee/controller.rb +6 -3
- data/lib/cpee/implementation.rb +23 -8
- data/lib/cpee/implementation_notifications.rb +1 -1
- data/lib/cpee/persistence.rb +2 -1
- data/lib/cpee/redis.rb +57 -0
- data/server/handlerwrappers/default.rb +15 -15
- data/server/routing/end.rb +16 -4
- data/server/routing/forward-events.rb +19 -7
- data/server/routing/forward-votes.rb +19 -7
- data/server/routing/persist.rb +27 -15
- data/tools/cpee +5 -5
- data/tools/test/README +4 -0
- data/tools/test/config.json +3 -0
- data/tools/test/contrib/graph_example.svg +1166 -0
- data/tools/test/contrib/legend.svg +817 -0
- data/tools/test/contrib/symbols.svg +224 -0
- data/tools/test/contrib/transformation1.xsl +264 -0
- data/tools/test/contrib/transformation2.xsl +10 -0
- data/tools/test/contrib/tree_example.svg +788 -0
- data/tools/test/css/model.css +24 -0
- data/tools/test/css/track.css +60 -0
- data/tools/test/css/ui.css +214 -0
- data/tools/test/css/wfadaptor.css +422 -0
- data/tools/test/edit.html +258 -0
- data/tools/test/graph.html +69 -0
- data/tools/test/index.html +258 -0
- data/tools/test/js/details.js +109 -0
- data/tools/test/js/instance.js +1344 -0
- data/tools/test/js/model.js +41 -0
- data/tools/test/js/parameters.js +82 -0
- data/tools/test/js/track.js +18 -0
- data/tools/test/js/ui.js +104 -0
- data/tools/test/js/wfadaptor.js +763 -0
- data/tools/test/js_libs.zip +0 -0
- data/tools/test/js_libs/Makefile +2 -0
- data/tools/test/js_libs/ansi_up.js +333 -0
- data/tools/test/js_libs/console.js +80 -0
- data/tools/test/js_libs/custommenu.css +84 -0
- data/tools/test/js_libs/custommenu.js +104 -0
- data/tools/test/js_libs/experiments1/relaxngui.css +185 -0
- data/tools/test/js_libs/experiments1/relaxngui.js +488 -0
- data/tools/test/js_libs/experiments1/rngtest9.html +60 -0
- data/tools/test/js_libs/experiments1/rngtest9.rng +35 -0
- data/tools/test/js_libs/experiments1/rngtest9.xml +8 -0
- data/tools/test/js_libs/jquery-2.2.4.min.js +4 -0
- data/tools/test/js_libs/jquery-3.2.1.min.js +4 -0
- data/tools/test/js_libs/jquery-3.3.1.min.js +2 -0
- data/tools/test/js_libs/jquery.browser.js +40 -0
- data/tools/test/js_libs/jquery.caret.min.js +10 -0
- data/tools/test/js_libs/jquery.cookie.js +117 -0
- data/tools/test/js_libs/jquery.min.js +1 -0
- data/tools/test/js_libs/jquery.svg.min.js +6 -0
- data/tools/test/js_libs/jquery.svgdom.min.js +6 -0
- data/tools/test/js_libs/markdown.min.js +1 -0
- data/tools/test/js_libs/parsequery.js +21 -0
- data/tools/test/js_libs/printf.js +368 -0
- data/tools/test/js_libs/relaxngui.css +213 -0
- data/tools/test/js_libs/relaxngui.js +543 -0
- data/tools/test/js_libs/strftime.min.js +1 -0
- data/tools/test/js_libs/tests/dataelements.html +59 -0
- data/tools/test/js_libs/tests/dataelements.rng +8 -0
- data/tools/test/js_libs/tests/dataelements.xml +3 -0
- data/tools/test/js_libs/tests/relaxngui.css +203 -0
- data/tools/test/js_libs/tests/relaxngui.js +502 -0
- data/tools/test/js_libs/tests/rngtest1.html +66 -0
- data/tools/test/js_libs/tests/rngtest1.rng +147 -0
- data/tools/test/js_libs/tests/rngtest1.xml +13 -0
- data/tools/test/js_libs/tests/rngtest2.html +60 -0
- data/tools/test/js_libs/tests/rngtest2.rng +6 -0
- data/tools/test/js_libs/tests/rngtest2.xml +3 -0
- data/tools/test/js_libs/tests/rngtest3.html +60 -0
- data/tools/test/js_libs/tests/rngtest3.rng +23 -0
- data/tools/test/js_libs/tests/rngtest3.xml +9 -0
- data/tools/test/js_libs/tests/rngtest4.html +60 -0
- data/tools/test/js_libs/tests/rngtest4.rng +19 -0
- data/tools/test/js_libs/tests/rngtest4.xml +12 -0
- data/tools/test/js_libs/tests/rngtest5.html +60 -0
- data/tools/test/js_libs/tests/rngtest5.rng +75 -0
- data/tools/test/js_libs/tests/rngtest5.xml +40 -0
- data/tools/test/js_libs/tests/rngtest6.html +60 -0
- data/tools/test/js_libs/tests/rngtest6.rng +24 -0
- data/tools/test/js_libs/tests/rngtest6.xml +6 -0
- data/tools/test/js_libs/tests/rngtest8.html +60 -0
- data/tools/test/js_libs/tests/rngtest8.rng +13 -0
- data/tools/test/js_libs/tests/rngtest8.xml +2 -0
- data/tools/test/js_libs/tests/rngtest9.html +60 -0
- data/tools/test/js_libs/tests/rngtest9.rng +31 -0
- data/tools/test/js_libs/tests/rngtest9.xml +8 -0
- data/tools/test/js_libs/ui.css +333 -0
- data/tools/test/js_libs/ui.html +168 -0
- data/tools/test/js_libs/ui.js +177 -0
- data/tools/test/js_libs/underscore.min.js +27 -0
- data/tools/test/js_libs/util.js +81 -0
- data/tools/test/js_libs/vkbeautify.0.99.00.beta.js +358 -0
- data/tools/test/js_libs/vkbeautify.js +1 -0
- data/tools/test/js_libs/webcomponents.min.js +196 -0
- data/tools/test/model.html +192 -0
- data/tools/test/rngs/attributes.rng +8 -0
- data/tools/test/rngs/dataelements.rng +8 -0
- data/tools/test/rngs/endpoints.rng +8 -0
- data/tools/test/templates.legacy/Async.xml +46 -0
- data/tools/test/templates.legacy/BCO.xml +70 -0
- data/tools/test/templates.legacy/BCS.xml +70 -0
- data/tools/test/templates.legacy/Centurio.xml +75 -0
- data/tools/test/templates.legacy/Concurrent.xml +40 -0
- data/tools/test/templates.legacy/Coopis Testset.xml +76 -0
- data/tools/test/templates.legacy/Endpoints and Data Manipulation.xml +30 -0
- data/tools/test/templates.legacy/ICSOC Testset.xml +95 -0
- data/tools/test/templates.legacy/Infinity.xml +28 -0
- data/tools/test/templates.legacy/Lego Boxer.xml +31 -0
- data/tools/test/templates.legacy/Lego Conveyor.xml +31 -0
- data/tools/test/templates.legacy/Lego Crane.xml +87 -0
- data/tools/test/templates.legacy/Lego Ejector.xml +55 -0
- data/tools/test/templates.legacy/Lego Full.xml +142 -0
- data/tools/test/templates.legacy/Lego Liddy.xml +40 -0
- data/tools/test/templates.legacy/Lego Plate.xml +31 -0
- data/tools/test/templates.legacy/Lego Transporter.xml +43 -0
- data/tools/test/templates.legacy/Lego_Part_1.xml +85 -0
- data/tools/test/templates.legacy/LgLinear.xml +65 -0
- data/tools/test/templates.legacy/Linear.xml +77 -0
- data/tools/test/templates.legacy/Log.xml +117 -0
- data/tools/test/templates.legacy/Mangler 1.xml +87 -0
- data/tools/test/templates.legacy/Mangler 2.xml +103 -0
- data/tools/test/templates.legacy/Manuel Labels.xml +55 -0
- data/tools/test/templates.legacy/Promise.xml +275 -0
- data/tools/test/templates.legacy/SOPROMO Test Sonification.xml +83 -0
- data/tools/test/templates.legacy/Subprocess.xml +56 -0
- data/tools/test/templates.legacy/Syncing P34 1.xml +77 -0
- data/tools/test/templates.legacy/Syncing P34 2.xml +77 -0
- data/tools/test/templates.legacy/Syncing P34 3.xml +77 -0
- data/tools/test/templates.legacy/Syncing P34.xml +77 -0
- data/tools/test/templates.legacy/TEST - Bad Loop.xml +173 -0
- data/tools/test/templates.legacy/TEST - Wrong Positions.xml +174 -0
- data/tools/test/templates.legacy/Take_5.xml +48 -0
- data/tools/test/templates.legacy/Update.xml +32 -0
- data/tools/test/templates.legacy/Worklist Parallel.xml +104 -0
- data/tools/test/templates.legacy/Worklist Test CPEE.xml +40 -0
- data/tools/test/templates.legacy/Worklist Test.xml +42 -0
- data/tools/test/templates.legacy/Worklist Test2.xml +43 -0
- data/tools/test/templates.legacy/convert_cpee2.rb +15 -0
- data/tools/test/templates.legacy/convert_preset.rb +32 -0
- data/tools/test/templates.legacy/testsets.xml +37 -0
- data/tools/test/templates.legacy/transformations.xml +4 -0
- data/tools/test/templates/Coopis 2010.xml +76 -0
- data/tools/test/templates/IUPC arXiv:1104.3609 P34 1.xml +77 -0
- data/tools/test/templates/IUPC arXiv:1104.3609 P34 2.xml +77 -0
- data/tools/test/templates/IUPC arXiv:1104.3609 P34 3.xml +77 -0
- data/tools/test/templates/Track Test Local.xml +82 -0
- data/tools/test/templates/Track Test.xml +82 -0
- data/tools/test/templates/UR-VUE 2020 Manual Adjust.xml +182 -0
- data/tools/test/templates/UR-VUE 2020 Solution Baseline.xml +203 -0
- data/tools/test/templates/UR-VUE 2020 Solution NN.xml +197 -0
- data/tools/test/templates/UR-VUE 2020 Solution View.xml +151 -0
- data/tools/test/templates/UR-VUE 2020.xml +26 -0
- data/tools/test/templates/Worklist.xml +42 -0
- data/tools/test/templates/instantiate.local/Take_Sub.xml +59 -0
- data/tools/test/templates/instantiate/Take_Perf.xml +46 -0
- data/tools/test/templates/instantiate/Take_Sub.xml +58 -0
- data/tools/test/templates/instantiate/Take_X.xml +48 -0
- data/tools/test/themes/compact/theme.js +1285 -0
- data/tools/test/themes/diana/theme.js +1650 -0
- data/tools/test/themes/extended/theme.js +1325 -0
- data/tools/test/themes/model/rngs/alternative.rng +1 -0
- data/tools/test/themes/model/rngs/call.rng +67 -0
- data/tools/test/themes/model/rngs/callmanipulate.rng +72 -0
- data/tools/test/themes/model/rngs/choose.rng +1 -0
- data/tools/test/themes/model/rngs/critical.rng +1 -0
- data/tools/test/themes/model/rngs/escape.rng +1 -0
- data/tools/test/themes/model/rngs/group.rng +1 -0
- data/tools/test/themes/model/rngs/loop.rng +1 -0
- data/tools/test/themes/model/rngs/manipulate.rng +1 -0
- data/tools/test/themes/model/rngs/otherwise.rng +1 -0
- data/tools/test/themes/model/rngs/parallel.rng +1 -0
- data/tools/test/themes/model/rngs/parallel_branch.rng +1 -0
- data/tools/test/themes/model/rngs/scripts.rng +7 -0
- data/tools/test/themes/model/rngs/stop.rng +1 -0
- data/tools/test/themes/model/rngs/terminate.rng +1 -0
- data/tools/test/themes/model/theme.js +1268 -0
- data/tools/test/themes/packed/theme.js +1286 -0
- data/tools/test/themes/preset/rngs/alternative.rng +25 -0
- data/tools/test/themes/preset/rngs/call.rng +122 -0
- data/tools/test/themes/preset/rngs/callmanipulate.rng +145 -0
- data/tools/test/themes/preset/rngs/choose.rng +14 -0
- data/tools/test/themes/preset/rngs/closed_loop.rng +62 -0
- data/tools/test/themes/preset/rngs/closed_loop_cancel.rng +5 -0
- data/tools/test/themes/preset/rngs/closed_loop_control.rng +31 -0
- data/tools/test/themes/preset/rngs/closed_loop_measuring.rng +12 -0
- data/tools/test/themes/preset/rngs/critical.rng +5 -0
- data/tools/test/themes/preset/rngs/escape.rng +1 -0
- data/tools/test/themes/preset/rngs/group.rng +3 -0
- data/tools/test/themes/preset/rngs/loop.rng +22 -0
- data/tools/test/themes/preset/rngs/manipulate.rng +9 -0
- data/tools/test/themes/preset/rngs/otherwise.rng +22 -0
- data/tools/test/themes/preset/rngs/parallel.rng +21 -0
- data/tools/test/themes/preset/rngs/parallel_branch.rng +8 -0
- data/tools/test/themes/preset/rngs/scripts.rng +23 -0
- data/tools/test/themes/preset/rngs/stop.rng +5 -0
- data/tools/test/themes/preset/rngs/terminate.rng +1 -0
- data/tools/test/themes/preset/symbols/alternative.svg +5 -0
- data/tools/test/themes/preset/symbols/arrow.svg +3 -0
- data/tools/test/themes/preset/symbols/call.svg +6 -0
- data/tools/test/themes/preset/symbols/callmanipulate.svg +8 -0
- data/tools/test/themes/preset/symbols/choose.svg +5 -0
- data/tools/test/themes/preset/symbols/choose_exclusive.svg +5 -0
- data/tools/test/themes/preset/symbols/choose_inclusive.svg +4 -0
- data/tools/test/themes/preset/symbols/closed_loop.svg +5 -0
- data/tools/test/themes/preset/symbols/closed_loop_cancel.svg +5 -0
- data/tools/test/themes/preset/symbols/closed_loop_control.svg +5 -0
- data/tools/test/themes/preset/symbols/closed_loop_measuring.svg +6 -0
- data/tools/test/themes/preset/symbols/complex.svg +8 -0
- data/tools/test/themes/preset/symbols/critical.svg +4 -0
- data/tools/test/themes/preset/symbols/end.svg +3 -0
- data/tools/test/themes/preset/symbols/escape.svg +5 -0
- data/tools/test/themes/preset/symbols/event_end.svg +3 -0
- data/tools/test/themes/preset/symbols/loop.svg +5 -0
- data/tools/test/themes/preset/symbols/manipulate.svg +4 -0
- data/tools/test/themes/preset/symbols/otherwise.svg +5 -0
- data/tools/test/themes/preset/symbols/parallel.svg +5 -0
- data/tools/test/themes/preset/symbols/parallel_branch.svg +5 -0
- data/tools/test/themes/preset/symbols/parallel_branch_compact.svg +4 -0
- data/tools/test/themes/preset/symbols/parallel_branch_event.svg +14 -0
- data/tools/test/themes/preset/symbols/parallel_branch_normal.svg +5 -0
- data/tools/test/themes/preset/symbols/scripts.svg +4 -0
- data/tools/test/themes/preset/symbols/start.svg +3 -0
- data/tools/test/themes/preset/symbols/stop.svg +5 -0
- data/tools/test/themes/preset/symbols/terminate.svg +4 -0
- data/tools/test/themes/preset/theme.js +1287 -0
- data/tools/test/track.html +142 -0
- metadata +221 -3
- data/cockpit/edit.html +0 -1
@@ -0,0 +1,177 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of CPEE.
|
3
|
+
|
4
|
+
CPEE is free software: you can redistribute it and/or modify it under the terms
|
5
|
+
of the GNU General Public License as published by the Free Software Foundation,
|
6
|
+
either version 3 of the License, or (at your option) any later version.
|
7
|
+
|
8
|
+
CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
9
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
10
|
+
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
11
|
+
|
12
|
+
You should have received a copy of the GNU General Public License along with
|
13
|
+
CPEE (file COPYING in the main directory). If not, see
|
14
|
+
<http://www.gnu.org/licenses/>.
|
15
|
+
*/
|
16
|
+
|
17
|
+
function ui_click_tab(moi) { // {{{
|
18
|
+
$(moi).trigger('click');
|
19
|
+
} // }}}
|
20
|
+
|
21
|
+
function ui_close_tab(moi){
|
22
|
+
var active = $(moi).parent().attr('data-tab');
|
23
|
+
var tabbed = $(moi).parent().parent().parent();
|
24
|
+
var is_inactive = $(moi).parent().hasClass('inactive');
|
25
|
+
$('*[data-tab=' + active + ']').remove();
|
26
|
+
$('*[data-belongs-to-tab=' + active + ']').remove();
|
27
|
+
if (!is_inactive)
|
28
|
+
ui_click_tab($('ui-tabbar ui-tab.default'));
|
29
|
+
}
|
30
|
+
|
31
|
+
function ui_add_close(moi) {
|
32
|
+
$(moi).append($('<ui-close>✖</ui-close>'));
|
33
|
+
}
|
34
|
+
|
35
|
+
function ui_empty_tab_contents(id) {
|
36
|
+
$('ui-content ui-area[data-belongs-to-tab=' + id + ']').empty();
|
37
|
+
}
|
38
|
+
|
39
|
+
function ui_add_tab(tabbed,title,id,closeable,additionalclasses) {
|
40
|
+
additionalclasses = typeof additionalclasses !== 'undefined' ? additionalclasses : '';
|
41
|
+
if ($('ui-tabbar ui-tab[data-tab=' + id + ']').length > 0) {
|
42
|
+
ui_activate_tab($('ui-tabbar ui-tab[data-tab=' + id + ']'));
|
43
|
+
return false;
|
44
|
+
} else {
|
45
|
+
var instab = $("<ui-tab class='inactive" + (closeable ? ' closeable' : '') + (additionalclasses == '' ? '' : ' ' + additionalclasses) + "' data-tab='" + id + "'>" + title + "</ui-tab>");
|
46
|
+
var insarea = $("<ui-area data-belongs-to-tab='" + id + "' class='inactive'></ui-area>");
|
47
|
+
$(tabbed).find('ui-behind').before(instab);
|
48
|
+
$(tabbed).find('ui-content').append(insarea);
|
49
|
+
ui_add_close($('ui-tabbar ui-tab[data-tab=' + id + ']'));
|
50
|
+
return true;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
function ui_add_tab_active(tabbed,title,id,closeable,additionalclasses) {
|
54
|
+
var state = ui_add_tab(tabbed,title,id,closeable,additionalclasses);
|
55
|
+
if (state) { ui_activate_tab($('ui-tabbar ui-tab[data-tab=' + id + ']')); }
|
56
|
+
return state;
|
57
|
+
}
|
58
|
+
|
59
|
+
function ui_clone_tab(tabbar,original,title,id,closeable,additionalclasses) {
|
60
|
+
additionalclasses = typeof additionalclasses !== 'undefined' ? additionalclasses : '';
|
61
|
+
var instab = $("<ui-tab class='inactive" + (closeable ? ' closeable' : '') + (additionalclasses == '' ? '' : ' ' + additionalclasses) + "' data-tab='" + id + "' id='tab_" + id + "'>" + title + "</ui-tab>");
|
62
|
+
var insarea = original.clone();
|
63
|
+
insarea.attr("data-belongs-to-tab",id);
|
64
|
+
insarea.attr("class","inactive");
|
65
|
+
$(tabbar).find('ui-behind').before(instab);
|
66
|
+
$(tabbar).parent().append(insarea);
|
67
|
+
ui_add_close($('ui-tabbed ui-tab[data-tab=' + id + ']'));
|
68
|
+
}
|
69
|
+
|
70
|
+
(function($) { //{{{
|
71
|
+
$.fn.dragcolumn = function() {
|
72
|
+
var drag = $(this);
|
73
|
+
var prev = drag.prev();
|
74
|
+
var next = drag.next();
|
75
|
+
|
76
|
+
this.on("mousedown", function(e) {
|
77
|
+
drag.addClass('draggable');
|
78
|
+
$(document).one("mouseup", function(e) {
|
79
|
+
drag.removeClass('draggable');
|
80
|
+
e.preventDefault();
|
81
|
+
});
|
82
|
+
e.preventDefault();
|
83
|
+
});
|
84
|
+
|
85
|
+
$(document).on("mousemove", function(e) {
|
86
|
+
if (!drag.hasClass('draggable'))
|
87
|
+
return;
|
88
|
+
|
89
|
+
// Assume 50/50 split between prev and next then adjust to
|
90
|
+
// the next X for prev
|
91
|
+
var total = prev.outerWidth() + next.outerWidth();
|
92
|
+
var pos = e.pageX - prev.offset().left;
|
93
|
+
if (pos > total) {
|
94
|
+
pos = total;
|
95
|
+
}
|
96
|
+
|
97
|
+
var leftPercentage = pos / total;
|
98
|
+
var rightPercentage = 1 - leftPercentage;
|
99
|
+
|
100
|
+
prev.css('flex', leftPercentage.toString());
|
101
|
+
next.css('flex', rightPercentage.toString());
|
102
|
+
|
103
|
+
e.preventDefault();
|
104
|
+
});
|
105
|
+
}
|
106
|
+
$.fn.dragresize = function() {
|
107
|
+
var drag = $(this);
|
108
|
+
var prev = drag.prev();
|
109
|
+
var initpos = 0;
|
110
|
+
var initheight = $("ui-content",prev).height();
|
111
|
+
|
112
|
+
this.on("mousedown", function(e) {
|
113
|
+
drag.addClass('draggable');
|
114
|
+
initpos = e.pageY;
|
115
|
+
$(document).one("mouseup", function(e) {
|
116
|
+
drag.removeClass('draggable');
|
117
|
+
e.preventDefault();
|
118
|
+
});
|
119
|
+
e.preventDefault();
|
120
|
+
});
|
121
|
+
|
122
|
+
$(document).on("mousemove", function(e) {
|
123
|
+
if (!drag.hasClass('draggable'))
|
124
|
+
return;
|
125
|
+
|
126
|
+
var pos = initheight - (initpos - e.pageY);
|
127
|
+
if (pos < 0)
|
128
|
+
return;
|
129
|
+
|
130
|
+
$("ui-content",prev).css('height', pos.toString());
|
131
|
+
|
132
|
+
e.preventDefault();
|
133
|
+
});
|
134
|
+
}
|
135
|
+
})(jQuery); //}}}
|
136
|
+
|
137
|
+
function ui_activate_tab(moi) { // {{{
|
138
|
+
var active = $(moi).attr('data-tab');
|
139
|
+
var tabbed = $(moi).parent().parent();
|
140
|
+
var tabs = [];
|
141
|
+
$("ui-tabbar > ui-tab",tabbed).each(function(){
|
142
|
+
if (!$(this).attr('class').match(/switch/)) {
|
143
|
+
tabs.push($(this).attr('data-tab'));
|
144
|
+
}
|
145
|
+
});
|
146
|
+
$(".inactive",tabbed).removeClass("inactive");
|
147
|
+
$.each(tabs,function(a,b){
|
148
|
+
if (b != active) {
|
149
|
+
$("ui-tabbar ui-tab[data-tab=" + b + "]",tabbed).addClass("inactive");
|
150
|
+
$("ui-content *[data-belongs-to-tab=" + b + "]",tabbed).addClass("inactive");
|
151
|
+
}
|
152
|
+
});
|
153
|
+
} // }}}
|
154
|
+
function ui_toggle_vis_tab(moi) {// {{{
|
155
|
+
if ($(moi)[0].nodeName == 'UI-TABBED') {
|
156
|
+
var tabbed = $(moi);
|
157
|
+
}
|
158
|
+
if ($(moi)[0].nodeName == 'UI-TAB') {
|
159
|
+
var tabbed = $(moi).parent().parent();
|
160
|
+
}
|
161
|
+
if (tabbed) {
|
162
|
+
tabbed.toggleClass('off');
|
163
|
+
}
|
164
|
+
}// }}}
|
165
|
+
|
166
|
+
$(document).ready(function() {
|
167
|
+
if (!($.browser.name == "Firefox" && $.browser.version >= 20) && !($.browser.name == "Chrome" && $.browser.version >= 30)) {
|
168
|
+
$('body').children().remove();
|
169
|
+
$('body').append('Sorry, only Firefox >= 20.0 and Chrom(e|ium) >= 17 for now.');
|
170
|
+
}
|
171
|
+
$('ui-rest ui-content ui-resizehandle').dragcolumn();
|
172
|
+
$('*[is=x-ui] > ui-resizehandle').dragresize();
|
173
|
+
$(document).on('click','ui-tabbar ui-tab.switch',function(){ui_toggle_vis_tab(this);});
|
174
|
+
$(document).on('click','ui-tabbar ui-tab:not(.switch)',function(){ui_activate_tab(this);});
|
175
|
+
ui_add_close($('ui-tabbar ui-tab.closeable'));
|
176
|
+
$(document).on('click','ui-tabbar ui-tab.closeable ui-close',function(){ui_close_tab(this);});
|
177
|
+
});
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// Underscore.js 1.1.7
|
2
|
+
// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
|
3
|
+
// Underscore is freely distributable under the MIT license.
|
4
|
+
// Portions of Underscore are inspired or borrowed from Prototype,
|
5
|
+
// Oliver Steele's Functional, and John Resig's Micro-Templating.
|
6
|
+
// For all details and documentation:
|
7
|
+
// http://documentcloud.github.com/underscore
|
8
|
+
(function(){var p=this,C=p._,m={},i=Array.prototype,n=Object.prototype,f=i.slice,D=i.unshift,E=n.toString,l=n.hasOwnProperty,s=i.forEach,t=i.map,u=i.reduce,v=i.reduceRight,w=i.filter,x=i.every,y=i.some,o=i.indexOf,z=i.lastIndexOf;n=Array.isArray;var F=Object.keys,q=Function.prototype.bind,b=function(a){return new j(a)};typeof module!=="undefined"&&module.exports?(module.exports=b,b._=b):p._=b;b.VERSION="1.1.7";var h=b.each=b.forEach=function(a,c,b){if(a!=null)if(s&&a.forEach===s)a.forEach(c,b);else if(a.length===
|
9
|
+
+a.length)for(var e=0,k=a.length;e<k;e++){if(e in a&&c.call(b,a[e],e,a)===m)break}else for(e in a)if(l.call(a,e)&&c.call(b,a[e],e,a)===m)break};b.map=function(a,c,b){var e=[];if(a==null)return e;if(t&&a.map===t)return a.map(c,b);h(a,function(a,g,G){e[e.length]=c.call(b,a,g,G)});return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var k=d!==void 0;a==null&&(a=[]);if(u&&a.reduce===u)return e&&(c=b.bind(c,e)),k?a.reduce(c,d):a.reduce(c);h(a,function(a,b,f){k?d=c.call(e,d,a,b,f):(d=a,k=!0)});if(!k)throw new TypeError("Reduce of empty array with no initial value");
|
10
|
+
return d};b.reduceRight=b.foldr=function(a,c,d,e){a==null&&(a=[]);if(v&&a.reduceRight===v)return e&&(c=b.bind(c,e)),d!==void 0?a.reduceRight(c,d):a.reduceRight(c);a=(b.isArray(a)?a.slice():b.toArray(a)).reverse();return b.reduce(a,c,d,e)};b.find=b.detect=function(a,c,b){var e;A(a,function(a,g,f){if(c.call(b,a,g,f))return e=a,!0});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(w&&a.filter===w)return a.filter(c,b);h(a,function(a,g,f){c.call(b,a,g,f)&&(e[e.length]=a)});return e};
|
11
|
+
b.reject=function(a,c,b){var e=[];if(a==null)return e;h(a,function(a,g,f){c.call(b,a,g,f)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=!0;if(a==null)return e;if(x&&a.every===x)return a.every(c,b);h(a,function(a,g,f){if(!(e=e&&c.call(b,a,g,f)))return m});return e};var A=b.some=b.any=function(a,c,d){c=c||b.identity;var e=!1;if(a==null)return e;if(y&&a.some===y)return a.some(c,d);h(a,function(a,b,f){if(e|=c.call(d,a,b,f))return m});return!!e};b.include=b.contains=function(a,c){var b=
|
12
|
+
!1;if(a==null)return b;if(o&&a.indexOf===o)return a.indexOf(c)!=-1;A(a,function(a){if(b=a===c)return!0});return b};b.invoke=function(a,c){var d=f.call(arguments,2);return b.map(a,function(a){return(c.call?c||a:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,
|
13
|
+
c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b<e.computed&&(e={value:a,computed:b})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,f){return{value:a,criteria:c.call(d,a,b,f)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,b){var d={};h(a,function(a,f){var g=b(a,f);(d[g]||(d[g]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||
|
14
|
+
(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return f.call(a);if(b.isArguments(a))return f.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?f.call(a,0,b):a[0]};b.rest=b.tail=function(a,b,d){return f.call(a,b==null||d?1:b)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.filter(a,
|
15
|
+
function(a){return!!a})};b.flatten=function(a){return b.reduce(a,function(a,d){if(b.isArray(d))return a.concat(b.flatten(d));a[a.length]=d;return a},[])};b.without=function(a){return b.difference(a,f.call(arguments,1))};b.uniq=b.unique=function(a,c){return b.reduce(a,function(a,e,f){if(0==f||(c===!0?b.last(a)!=e:!b.include(a,e)))a[a.length]=e;return a},[])};b.union=function(){return b.uniq(b.flatten(arguments))};b.intersection=b.intersect=function(a){var c=f.call(arguments,1);return b.filter(b.uniq(a),
|
16
|
+
function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a,c){return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=f.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(o&&a.indexOf===o)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,
|
17
|
+
b){if(a==null)return-1;if(z&&a.lastIndexOf===z)return a.lastIndexOf(b);for(var d=a.length;d--;)if(a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);d=arguments[2]||1;for(var e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};b.bind=function(a,b){if(a.bind===q&&q)return q.apply(a,f.call(arguments,1));var d=f.call(arguments,2);return function(){return a.apply(b,d.concat(f.call(arguments)))}};b.bindAll=function(a){var c=f.call(arguments,1);
|
18
|
+
c.length==0&&(c=b.functions(a));h(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var b=c.apply(this,arguments);return l.call(d,b)?d[b]:d[b]=a.apply(this,arguments)}};b.delay=function(a,b){var d=f.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(f.call(arguments,1)))};var B=function(a,b,d){var e;return function(){var f=this,g=arguments,h=function(){e=null;
|
19
|
+
a.apply(f,g)};d&&clearTimeout(e);if(d||!e)e=setTimeout(h,b)}};b.throttle=function(a,b){return B(a,b,!1)};b.debounce=function(a,b){return B(a,b,!0)};b.once=function(a){var b=!1,d;return function(){if(b)return d;b=!0;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(f.call(arguments));return b.apply(this,d)}};b.compose=function(){var a=f.call(arguments);return function(){for(var b=f.call(arguments),d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=
|
20
|
+
function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}};b.keys=F||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)l.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){h(f.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};b.defaults=function(a){h(f.call(arguments,
|
21
|
+
1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,c){if(a===c)return!0;var d=typeof a;if(d!=typeof c)return!1;if(a==c)return!0;if(!a&&c||a&&!c)return!1;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual)return a.isEqual(c);if(c.isEqual)return c.isEqual(a);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return!1;
|
22
|
+
if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return!1;if(a.length&&a.length!==c.length)return!1;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return!1;for(var f in a)if(!(f in c)||!b.isEqual(a[f],c[f]))return!1;return!0};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(l.call(a,c))return!1;return!0};b.isElement=function(a){return!!(a&&a.nodeType==
|
23
|
+
1)};b.isArray=n||function(a){return E.call(a)==="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return!(!a||!l.call(a,"callee"))};b.isFunction=function(a){return!(!a||!a.constructor||!a.call||!a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===!0||a===!1};b.isDate=function(a){return!(!a||!a.getTimezoneOffset||
|
24
|
+
!a.setUTCFullYear)};b.isRegExp=function(a){return!(!a||!a.test||!a.exec||!(a.ignoreCase||a.ignoreCase===!1))};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){p._=C;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.mixin=function(a){h(b.functions(a),function(c){H(c,b[c]=a[c])})};var I=0;b.uniqueId=function(a){var b=I++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g};
|
25
|
+
b.template=function(a,c){var d=b.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return c?d(c):d};
|
26
|
+
var j=function(a){this._wrapped=a};b.prototype=j.prototype;var r=function(a,c){return c?b(a).chain():a},H=function(a,c){j.prototype[a]=function(){var a=f.call(arguments);D.call(a,this._wrapped);return r(c.apply(b,a),this._chain)}};b.mixin(b);h(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=i[a];j.prototype[a]=function(){b.apply(this._wrapped,arguments);return r(this._wrapped,this._chain)}});h(["concat","join","slice"],function(a){var b=i[a];j.prototype[a]=function(){return r(b.apply(this._wrapped,
|
27
|
+
arguments),this._chain)}});j.prototype.chain=function(){this._chain=!0;return this};j.prototype.value=function(){return this._wrapped}})();
|
@@ -0,0 +1,81 @@
|
|
1
|
+
$B64 = function(str) {
|
2
|
+
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
|
3
|
+
function toSolidBytes(match, p1) {
|
4
|
+
return String.fromCharCode('0x' + p1);
|
5
|
+
}));
|
6
|
+
}
|
7
|
+
|
8
|
+
$.fn.to_em_raw = function(settings){
|
9
|
+
settings = jQuery.extend({
|
10
|
+
scope: 'body'
|
11
|
+
}, settings);
|
12
|
+
var that = parseInt(this[0]||"0",10),
|
13
|
+
scopeTest = jQuery('<div style="display: none; font-size: 1em; margin: 0; padding:0; height: auto; line-height: 1; border:0;"> </div>').appendTo(settings.scope),
|
14
|
+
scopeVal = scopeTest.height();
|
15
|
+
scopeTest.remove();
|
16
|
+
return (that / scopeVal).toFixed(8);
|
17
|
+
};
|
18
|
+
$.fn.to_em = function(settings){
|
19
|
+
return $(this[0]).to_em_raw(settings) + 'em';
|
20
|
+
};
|
21
|
+
|
22
|
+
$.fn.get_val = function () {
|
23
|
+
if ($(this).is('input') || $(this).is('select') || $(this).is('textarea')) {
|
24
|
+
return $(this).val();
|
25
|
+
} else {
|
26
|
+
var ret = $(this).html().replace(/<div>/g,'').replace(/<\/div>/g,'\n').replace(/<br\/?>/g,'\n').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,'\'').trim();
|
27
|
+
if (ret == '') $(this).empty();
|
28
|
+
return ret;
|
29
|
+
}
|
30
|
+
};
|
31
|
+
$.fn.set_val = function (val) {
|
32
|
+
if ($(this).is('input') || $(this).is('select') || $(this).is('textarea')) {
|
33
|
+
$(this).val(val);
|
34
|
+
} else {
|
35
|
+
$(this).text(val);
|
36
|
+
}
|
37
|
+
};
|
38
|
+
$.fn.serializePrettyXML = function () {
|
39
|
+
return vkbeautify.xml(this.serializeXML(),' ');
|
40
|
+
};
|
41
|
+
|
42
|
+
$.fn.serializeXML = function () {
|
43
|
+
var out = '';
|
44
|
+
if (typeof XMLSerializer == 'function') {
|
45
|
+
var xs = new XMLSerializer();
|
46
|
+
this.each(function() {
|
47
|
+
out += xs.serializeToString(this);
|
48
|
+
});
|
49
|
+
} else if (this[0] && this[0].xml != 'undefined') {
|
50
|
+
this.each(function() {
|
51
|
+
out += this.xml;
|
52
|
+
});
|
53
|
+
}
|
54
|
+
return out;
|
55
|
+
};
|
56
|
+
|
57
|
+
String.prototype.repeat = function(num) {
|
58
|
+
return new Array(num + 1).join(this);
|
59
|
+
};
|
60
|
+
|
61
|
+
String.prototype.unserialize = function() {
|
62
|
+
var data = this.split("&");
|
63
|
+
var ret = new Array();
|
64
|
+
$.each(data, function(){
|
65
|
+
var properties = this.split("=");
|
66
|
+
ret.push([properties[0], properties[1]]);
|
67
|
+
});
|
68
|
+
return ret;
|
69
|
+
};
|
70
|
+
|
71
|
+
$XR = function(xmlstr) {
|
72
|
+
if (typeof xmlstr == "string") {
|
73
|
+
return $.parseXML(xmlstr);
|
74
|
+
} else {
|
75
|
+
return $(xmlstr.ownerDocument || xmlstr);
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
$X = function(xmlstr) {
|
80
|
+
return $($.parseXML(xmlstr).documentElement);
|
81
|
+
};
|
@@ -0,0 +1,358 @@
|
|
1
|
+
/**
|
2
|
+
* vkBeautify - javascript plugin to pretty-print or minify text in XML, JSON, CSS and SQL formats.
|
3
|
+
*
|
4
|
+
* Version - 0.99.00.beta
|
5
|
+
* Copyright (c) 2012 Vadim Kiryukhin
|
6
|
+
* vkiryukhin @ gmail.com
|
7
|
+
* http://www.eslinstructor.net/vkbeautify/
|
8
|
+
*
|
9
|
+
* Dual licensed under the MIT and GPL licenses:
|
10
|
+
* http://www.opensource.org/licenses/mit-license.php
|
11
|
+
* http://www.gnu.org/licenses/gpl.html
|
12
|
+
*
|
13
|
+
* Pretty print
|
14
|
+
*
|
15
|
+
* vkbeautify.xml(text [,indent_pattern]);
|
16
|
+
* vkbeautify.json(text [,indent_pattern]);
|
17
|
+
* vkbeautify.css(text [,indent_pattern]);
|
18
|
+
* vkbeautify.sql(text [,indent_pattern]);
|
19
|
+
*
|
20
|
+
* @text - String; text to beatufy;
|
21
|
+
* @indent_pattern - Integer | String;
|
22
|
+
* Integer: number of white spaces;
|
23
|
+
* String: character string to visualize indentation ( can also be a set of white spaces )
|
24
|
+
* Minify
|
25
|
+
*
|
26
|
+
* vkbeautify.xmlmin(text [,preserve_comments]);
|
27
|
+
* vkbeautify.jsonmin(text);
|
28
|
+
* vkbeautify.cssmin(text [,preserve_comments]);
|
29
|
+
* vkbeautify.sqlmin(text);
|
30
|
+
*
|
31
|
+
* @text - String; text to minify;
|
32
|
+
* @preserve_comments - Bool; [optional];
|
33
|
+
* Set this flag to true to prevent removing comments from @text ( minxml and mincss functions only. )
|
34
|
+
*
|
35
|
+
* Examples:
|
36
|
+
* vkbeautify.xml(text); // pretty print XML
|
37
|
+
* vkbeautify.json(text, 4 ); // pretty print JSON
|
38
|
+
* vkbeautify.css(text, '. . . .'); // pretty print CSS
|
39
|
+
* vkbeautify.sql(text, '----'); // pretty print SQL
|
40
|
+
*
|
41
|
+
* vkbeautify.xmlmin(text, true);// minify XML, preserve comments
|
42
|
+
* vkbeautify.jsonmin(text);// minify JSON
|
43
|
+
* vkbeautify.cssmin(text);// minify CSS, remove comments ( default )
|
44
|
+
* vkbeautify.sqlmin(text);// minify SQL
|
45
|
+
*
|
46
|
+
*/
|
47
|
+
|
48
|
+
(function() {
|
49
|
+
|
50
|
+
function createShiftArr(step) {
|
51
|
+
|
52
|
+
var space = ' ';
|
53
|
+
|
54
|
+
if ( isNaN(parseInt(step)) ) { // argument is string
|
55
|
+
space = step;
|
56
|
+
} else { // argument is integer
|
57
|
+
switch(step) {
|
58
|
+
case 1: space = ' '; break;
|
59
|
+
case 2: space = ' '; break;
|
60
|
+
case 3: space = ' '; break;
|
61
|
+
case 4: space = ' '; break;
|
62
|
+
case 5: space = ' '; break;
|
63
|
+
case 6: space = ' '; break;
|
64
|
+
case 7: space = ' '; break;
|
65
|
+
case 8: space = ' '; break;
|
66
|
+
case 9: space = ' '; break;
|
67
|
+
case 10: space = ' '; break;
|
68
|
+
case 11: space = ' '; break;
|
69
|
+
case 12: space = ' '; break;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
var shift = ['\n']; // array of shifts
|
74
|
+
for(ix=0;ix<100;ix++){
|
75
|
+
shift.push(shift[ix]+space);
|
76
|
+
}
|
77
|
+
return shift;
|
78
|
+
}
|
79
|
+
|
80
|
+
function vkbeautify(){
|
81
|
+
this.step = ' '; // 4 spaces
|
82
|
+
this.shift = createShiftArr(this.step);
|
83
|
+
};
|
84
|
+
|
85
|
+
vkbeautify.prototype.xml = function(text,step) {
|
86
|
+
|
87
|
+
var ar = text.replace(/>\s{0,}</g,"><")
|
88
|
+
.replace(/</g,"~::~<")
|
89
|
+
.replace(/\s*xmlns\:/g,"~::~xmlns:")
|
90
|
+
// .replace(/\s*xmlns\=/g,"~::~xmlns=")
|
91
|
+
.split('~::~'),
|
92
|
+
len = ar.length,
|
93
|
+
inComment = false,
|
94
|
+
deep = 0,
|
95
|
+
str = '',
|
96
|
+
ix = 0,
|
97
|
+
shift = step ? createShiftArr(step) : this.shift;
|
98
|
+
|
99
|
+
for(ix=0;ix<len;ix++) {
|
100
|
+
// start comment or <![CDATA[...]]> or <!DOCTYPE //
|
101
|
+
if(ar[ix].search(/<!/) > -1) {
|
102
|
+
str += shift[deep]+ar[ix];
|
103
|
+
inComment = true;
|
104
|
+
// end comment or <![CDATA[...]]> //
|
105
|
+
if(ar[ix].search(/-->/) > -1 || ar[ix].search(/\]>/) > -1 || ar[ix].search(/!DOCTYPE/) > -1 ) {
|
106
|
+
inComment = false;
|
107
|
+
}
|
108
|
+
} else
|
109
|
+
// end comment or <![CDATA[...]]> //
|
110
|
+
if(ar[ix].search(/-->/) > -1 || ar[ix].search(/\]>/) > -1) {
|
111
|
+
str += ar[ix];
|
112
|
+
inComment = false;
|
113
|
+
} else
|
114
|
+
// <elm></elm> //
|
115
|
+
if( /^<\w/.exec(ar[ix-1]) && /^<\/\w/.exec(ar[ix]) &&
|
116
|
+
/^<[\w:\-\.\,]+/.exec(ar[ix-1]) == /^<\/[\w:\-\.\,]+/.exec(ar[ix])[0].replace('/','')) {
|
117
|
+
str += ar[ix];
|
118
|
+
if(!inComment) deep--;
|
119
|
+
} else
|
120
|
+
// <elm> //
|
121
|
+
if(ar[ix].search(/<\w/) > -1 && ar[ix].search(/<\//) == -1 && ar[ix].search(/\/>/) == -1 ) {
|
122
|
+
str = !inComment ? str += shift[deep++]+ar[ix] : str += ar[ix];
|
123
|
+
} else
|
124
|
+
// <elm>...</elm> //
|
125
|
+
if(ar[ix].search(/<\w/) > -1 && ar[ix].search(/<\//) > -1) {
|
126
|
+
str = !inComment ? str += shift[deep]+ar[ix] : str += ar[ix];
|
127
|
+
} else
|
128
|
+
// </elm> //
|
129
|
+
if(ar[ix].search(/<\//) > -1) {
|
130
|
+
str = !inComment ? str += shift[--deep]+ar[ix] : str += ar[ix];
|
131
|
+
} else
|
132
|
+
// <elm/> //
|
133
|
+
if(ar[ix].search(/\/>/) > -1 ) {
|
134
|
+
str = !inComment ? str += shift[deep]+ar[ix] : str += ar[ix];
|
135
|
+
} else
|
136
|
+
// <? xml ... ?> //
|
137
|
+
if(ar[ix].search(/<\?/) > -1) {
|
138
|
+
str += shift[deep]+ar[ix];
|
139
|
+
} else
|
140
|
+
// xmlns //
|
141
|
+
if( ar[ix].search(/xmlns\:/) > -1 || ar[ix].search(/xmlns\=/) > -1) {
|
142
|
+
str += shift[deep]+ar[ix];
|
143
|
+
}
|
144
|
+
|
145
|
+
else {
|
146
|
+
str += ar[ix];
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
return (str[0] == '\n') ? str.slice(1) : str;
|
151
|
+
}
|
152
|
+
|
153
|
+
vkbeautify.prototype.json = function(text,step) {
|
154
|
+
|
155
|
+
var step = step ? step : this.step;
|
156
|
+
|
157
|
+
if (typeof JSON === 'undefined' ) return text;
|
158
|
+
|
159
|
+
if ( typeof text === "string" ) return JSON.stringify(JSON.parse(text), null, step);
|
160
|
+
if ( typeof text === "object" ) return JSON.stringify(text, null, step);
|
161
|
+
|
162
|
+
return text; // text is not string nor object
|
163
|
+
}
|
164
|
+
|
165
|
+
vkbeautify.prototype.css = function(text, step) {
|
166
|
+
|
167
|
+
var ar = text.replace(/\s{1,}/g,' ')
|
168
|
+
.replace(/\{/g,"{~::~")
|
169
|
+
.replace(/\}/g,"~::~}~::~")
|
170
|
+
.replace(/\;/g,";~::~")
|
171
|
+
.replace(/\/\*/g,"~::~/*")
|
172
|
+
.replace(/\*\//g,"*/~::~")
|
173
|
+
.replace(/~::~\s{0,}~::~/g,"~::~")
|
174
|
+
.split('~::~'),
|
175
|
+
len = ar.length,
|
176
|
+
deep = 0,
|
177
|
+
str = '',
|
178
|
+
ix = 0,
|
179
|
+
shift = step ? createShiftArr(step) : this.shift;
|
180
|
+
|
181
|
+
for(ix=0;ix<len;ix++) {
|
182
|
+
|
183
|
+
if( /\{/.exec(ar[ix])) {
|
184
|
+
str += shift[deep++]+ar[ix];
|
185
|
+
} else
|
186
|
+
if( /\}/.exec(ar[ix])) {
|
187
|
+
str += shift[--deep]+ar[ix];
|
188
|
+
} else
|
189
|
+
if( /\*\\/.exec(ar[ix])) {
|
190
|
+
str += shift[deep]+ar[ix];
|
191
|
+
}
|
192
|
+
else {
|
193
|
+
str += shift[deep]+ar[ix];
|
194
|
+
}
|
195
|
+
}
|
196
|
+
return str.replace(/^\n{1,}/,'');
|
197
|
+
}
|
198
|
+
|
199
|
+
//----------------------------------------------------------------------------
|
200
|
+
|
201
|
+
function isSubquery(str, parenthesisLevel) {
|
202
|
+
return parenthesisLevel - (str.replace(/\(/g,'').length - str.replace(/\)/g,'').length )
|
203
|
+
}
|
204
|
+
|
205
|
+
function split_sql(str, tab) {
|
206
|
+
|
207
|
+
return str.replace(/\s{1,}/g," ")
|
208
|
+
|
209
|
+
.replace(/ AND /ig,"~::~"+tab+tab+"AND ")
|
210
|
+
.replace(/ BETWEEN /ig,"~::~"+tab+"BETWEEN ")
|
211
|
+
.replace(/ CASE /ig,"~::~"+tab+"CASE ")
|
212
|
+
.replace(/ ELSE /ig,"~::~"+tab+"ELSE ")
|
213
|
+
.replace(/ END /ig,"~::~"+tab+"END ")
|
214
|
+
.replace(/ FROM /ig,"~::~FROM ")
|
215
|
+
.replace(/ GROUP\s{1,}BY/ig,"~::~GROUP BY ")
|
216
|
+
.replace(/ HAVING /ig,"~::~HAVING ")
|
217
|
+
//.replace(/ SET /ig," SET~::~")
|
218
|
+
.replace(/ IN /ig," IN ")
|
219
|
+
|
220
|
+
.replace(/ JOIN /ig,"~::~JOIN ")
|
221
|
+
.replace(/ CROSS~::~{1,}JOIN /ig,"~::~CROSS JOIN ")
|
222
|
+
.replace(/ INNER~::~{1,}JOIN /ig,"~::~INNER JOIN ")
|
223
|
+
.replace(/ LEFT~::~{1,}JOIN /ig,"~::~LEFT JOIN ")
|
224
|
+
.replace(/ RIGHT~::~{1,}JOIN /ig,"~::~RIGHT JOIN ")
|
225
|
+
|
226
|
+
.replace(/ ON /ig,"~::~"+tab+"ON ")
|
227
|
+
.replace(/ OR /ig,"~::~"+tab+tab+"OR ")
|
228
|
+
.replace(/ ORDER\s{1,}BY/ig,"~::~ORDER BY ")
|
229
|
+
.replace(/ OVER /ig,"~::~"+tab+"OVER ")
|
230
|
+
|
231
|
+
.replace(/\(\s{0,}SELECT /ig,"~::~(SELECT ")
|
232
|
+
.replace(/\)\s{0,}SELECT /ig,")~::~SELECT ")
|
233
|
+
|
234
|
+
.replace(/ THEN /ig," THEN~::~"+tab+"")
|
235
|
+
.replace(/ UNION /ig,"~::~UNION~::~")
|
236
|
+
.replace(/ USING /ig,"~::~USING ")
|
237
|
+
.replace(/ WHEN /ig,"~::~"+tab+"WHEN ")
|
238
|
+
.replace(/ WHERE /ig,"~::~WHERE ")
|
239
|
+
.replace(/ WITH /ig,"~::~WITH ")
|
240
|
+
|
241
|
+
//.replace(/\,\s{0,}\(/ig,",~::~( ")
|
242
|
+
//.replace(/\,/ig,",~::~"+tab+tab+"")
|
243
|
+
|
244
|
+
.replace(/ ALL /ig," ALL ")
|
245
|
+
.replace(/ AS /ig," AS ")
|
246
|
+
.replace(/ ASC /ig," ASC ")
|
247
|
+
.replace(/ DESC /ig," DESC ")
|
248
|
+
.replace(/ DISTINCT /ig," DISTINCT ")
|
249
|
+
.replace(/ EXISTS /ig," EXISTS ")
|
250
|
+
.replace(/ NOT /ig," NOT ")
|
251
|
+
.replace(/ NULL /ig," NULL ")
|
252
|
+
.replace(/ LIKE /ig," LIKE ")
|
253
|
+
.replace(/\s{0,}SELECT /ig,"SELECT ")
|
254
|
+
.replace(/\s{0,}UPDATE /ig,"UPDATE ")
|
255
|
+
.replace(/ SET /ig," SET ")
|
256
|
+
|
257
|
+
.replace(/~::~{1,}/g,"~::~")
|
258
|
+
.split('~::~');
|
259
|
+
}
|
260
|
+
|
261
|
+
vkbeautify.prototype.sql = function(text,step) {
|
262
|
+
|
263
|
+
var ar_by_quote = text.replace(/\s{1,}/g," ")
|
264
|
+
.replace(/\'/ig,"~::~\'")
|
265
|
+
.split('~::~'),
|
266
|
+
len = ar_by_quote.length,
|
267
|
+
ar = [],
|
268
|
+
deep = 0,
|
269
|
+
tab = this.step,//+this.step,
|
270
|
+
inComment = true,
|
271
|
+
inQuote = false,
|
272
|
+
parenthesisLevel = 0,
|
273
|
+
str = '',
|
274
|
+
ix = 0,
|
275
|
+
shift = step ? createShiftArr(step) : this.shift;;
|
276
|
+
|
277
|
+
for(ix=0;ix<len;ix++) {
|
278
|
+
if(ix%2) {
|
279
|
+
ar = ar.concat(ar_by_quote[ix]);
|
280
|
+
} else {
|
281
|
+
ar = ar.concat(split_sql(ar_by_quote[ix], tab) );
|
282
|
+
}
|
283
|
+
}
|
284
|
+
|
285
|
+
len = ar.length;
|
286
|
+
for(ix=0;ix<len;ix++) {
|
287
|
+
|
288
|
+
parenthesisLevel = isSubquery(ar[ix], parenthesisLevel);
|
289
|
+
|
290
|
+
if( /\s{0,}\s{0,}SELECT\s{0,}/.exec(ar[ix])) {
|
291
|
+
ar[ix] = ar[ix].replace(/\,/g,",\n"+tab+tab+"")
|
292
|
+
}
|
293
|
+
|
294
|
+
if( /\s{0,}\s{0,}SET\s{0,}/.exec(ar[ix])) {
|
295
|
+
ar[ix] = ar[ix].replace(/\,/g,",\n"+tab+tab+"")
|
296
|
+
}
|
297
|
+
|
298
|
+
if( /\s{0,}\(\s{0,}SELECT\s{0,}/.exec(ar[ix])) {
|
299
|
+
deep++;
|
300
|
+
str += shift[deep]+ar[ix];
|
301
|
+
} else
|
302
|
+
if( /\'/.exec(ar[ix]) ) {
|
303
|
+
if(parenthesisLevel<1 && deep) {
|
304
|
+
deep--;
|
305
|
+
}
|
306
|
+
str += ar[ix];
|
307
|
+
}
|
308
|
+
else {
|
309
|
+
str += shift[deep]+ar[ix];
|
310
|
+
if(parenthesisLevel<1 && deep) {
|
311
|
+
deep--;
|
312
|
+
}
|
313
|
+
}
|
314
|
+
var junk = 0;
|
315
|
+
}
|
316
|
+
|
317
|
+
str = str.replace(/^\n{1,}/,'').replace(/\n{1,}/g,"\n");
|
318
|
+
return str;
|
319
|
+
}
|
320
|
+
|
321
|
+
|
322
|
+
vkbeautify.prototype.xmlmin = function(text, preserveComments) {
|
323
|
+
|
324
|
+
var str = preserveComments ? text
|
325
|
+
: text.replace(/\<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)\>/g,"")
|
326
|
+
.replace(/[ \r\n\t]{1,}xmlns/g, ' xmlns');
|
327
|
+
return str.replace(/>\s{0,}</g,"><");
|
328
|
+
}
|
329
|
+
|
330
|
+
vkbeautify.prototype.jsonmin = function(text) {
|
331
|
+
|
332
|
+
if (typeof JSON === 'undefined' ) return text;
|
333
|
+
|
334
|
+
return JSON.stringify(JSON.parse(text), null, 0);
|
335
|
+
|
336
|
+
}
|
337
|
+
|
338
|
+
vkbeautify.prototype.cssmin = function(text, preserveComments) {
|
339
|
+
|
340
|
+
var str = preserveComments ? text
|
341
|
+
: text.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\//g,"") ;
|
342
|
+
|
343
|
+
return str.replace(/\s{1,}/g,' ')
|
344
|
+
.replace(/\{\s{1,}/g,"{")
|
345
|
+
.replace(/\}\s{1,}/g,"}")
|
346
|
+
.replace(/\;\s{1,}/g,";")
|
347
|
+
.replace(/\/\*\s{1,}/g,"/*")
|
348
|
+
.replace(/\*\/\s{1,}/g,"*/");
|
349
|
+
}
|
350
|
+
|
351
|
+
vkbeautify.prototype.sqlmin = function(text) {
|
352
|
+
return text.replace(/\s{1,}/g," ").replace(/\s{1,}\(/,"(").replace(/\s{1,}\)/,")");
|
353
|
+
}
|
354
|
+
|
355
|
+
window.vkbeautify = new vkbeautify();
|
356
|
+
|
357
|
+
})();
|
358
|
+
|