-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
104 lines (95 loc) · 3.91 KB
/
index.html
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
<html>
<head>
<title>Beautify JS</title>
<script src="js/plugin.js"></script>
<script src="js/jsbeautify.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="style.css">
<script>
var headers = {
name: "BeautifyPlugin", version: "1.0", description: "Beautify editor code."
};
var provider = new orion.PluginProvider(headers);
var indent_size = 4;
var indent_char = ' ';
var serviceImpl = {
run: function (selectedText, text, selection) {
var toFormat = selectedText || text;
var formatted = js_beautify(toFormat, {
indent_size: indent_size,
indent_char: indent_char
});
return (selectedText ?
formatted :
{text: formatted});
},
updated: function (properties) {
if (properties) {
var value = JSON.parse(properties.indent_style);
indent_size = value.indent_size;
indent_char = value.indent_char;
}
}
};
var serviceProperties = {
name: "Beautify JS",
contentType: ["application/javascript", "text/html", "application/json"],
pid: "beautify.plugin"
};
provider.registerService(["orion.edit.command", "orion.cm.managedservice"],
serviceImpl, serviceProperties);
var PREF_VALUE_4_SPACES = '{"indent_size": 4, "indent_char": "A"}',
PREF_VALUE_1_TAB = '{"indent_size": 1, "indent_char": "\\t"}';
provider.registerServiceProvider("orion.core.setting", {}, {
settings: [{
pid: 'beautify.plugin',
name: 'Beautify JS',
tags: ['beautify', 'javascript', 'js', 'jsbeautify', 'formatting'],
category: 'Formatting',
properties: [{
id: 'indent_style',
name: 'Indent Style',
defaultValue: PREF_VALUE_4_SPACES,
options: [
{label: "1 Tab", value: PREF_VALUE_1_TAB},
{label: "4 Spaces", value: PREF_VALUE_4_SPACES}
],
type: 'string'
}]
}]
});
provider.connect();
</script>
</head>
<body>
<header class="dark_bg">
<div class="container">
<div class="logo"></div>
<h1>Orion JS Beautify Example - Irin</h1>
<h3>Example of simple orion plugin</h3>
</div>
</header>
<section>
<div class="container">
<script>
if (window.location.protocol === 'http:') {
var url = 'http://ide.codefresh.io/settings/settings.html#,category=plugins,installPlugin=' + window.location;
document.write('<a href="' + url +'" class="btn btn-default">Install in codefresh</a>');
document.write('<a href="https://' + window.location.hostname + window.location.pathname + '" class="btn btn-primary">Switch to OrionHUB mode</a>');
} else {
var url = 'http://ide.codefresh.io/settings/settings.html#,category=plugins,installPlugin=http://' + window.location.hostname + window.location.pathname;
document.write('<a href="' + url +'" class="btn btn-default">Install in codefresh</a>');
url = 'https://orionhub.org/settings/settings.html#,category=plugins,installPlugin=' + window.location;
document.write('<a href="' + url +'" class="btn btn-primary">Install in OrionHUB</a>');
}
</script>
</div>
</section>
<footer>
<div class="container">
under Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html),
and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html)
</div>
</footer>
</body>
</html>