This repository has been archived by the owner on Feb 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathsampleCommandsPlugin.html
84 lines (80 loc) · 2.46 KB
/
sampleCommandsPlugin.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2011, 2017." >
<meta http-equiv="Content-Language" content="en-us">
<script type="text/javascript" src="../orion/plugin.js"></script>
<script>
/*eslint-env browser, amd*/
/*global orion*/
window.onload = function() {
var provider = new orion.PluginProvider({postInstallUrl:"../plugin/list.html"});
provider.registerService("orion.navigate.command", {
run : function(item) {
window.alert("Running code on: " + item.Location);
}
}, {
image: "../images/gear.gif",
name: "Run Code on Single Item",
id: "sample.commands.sample1",
forceSingleItem: true,
tooltip: "Run plugin code only on single file/dir"
});
provider.registerService("orion.navigate.command", {
run : function(item) {
return item.Location;
}
}, {
image: "../images/gear.gif",
name: "Open HTML Raw",
id: "sample.commands.sample2",
forceSingleItem: true,
href: true,
contentType: ["text/html"],
tooltip: "Link to raw html on server"
});
provider.registerService("orion.navigate.command", {
run : function(items) {
var locations = [];
for (var i = 0; i<items.length; i++) {
locations.push(items[i].Location);
}
window.alert("Bulk operation on: " + locations);
}
}, {
image: "../images/gear.gif",
name: "Bulk Item Command",
id: "sample.commands.sample3",
tooltip: "Bulk command operates on selections"
});
provider.registerService("orion.navigate.command", {
run : function(item) {
window.alert("Running command for " + item.Location + ". I can even run on a non-navigator page like editor.");
}
}, {
image: "../images/gear.gif",
name: "Generic File Command",
forceSingleItem: true,
validationProperties: [
{source: "Directory", match: false}
],
id: "sample.commands.sample4",
tooltip: "Navigator command that can appear on other pages",
showGlobally: true
});
provider.registerService("orion.navigate.command", {}, {
image: "http://www.google.com/favicon.ico",
name: "Google Search",
id: "sample.commands.sample5",
forceSingleItem: true,
uriTemplate: "http://www.google.com/#q={,Name}",
tooltip: "Link to google search for this file name"
});
provider.connect();
};
</script>
</head>
<body>
</body>
</html>