-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
46 lines (40 loc) · 1.09 KB
/
index.js
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
(function (DreditorUI) {
/**
* @type {DreditorUI}
*/
var dreditor = new DreditorUI({
comments: true,
// Map Drupal extensions to their appropriate Prism language.
prismExtensionLanguageMap: {
coffee: ['coffeescript', 'javascript'],
engine: 'php',
htaccess: 'apacheconf',
inc: 'php',
info: 'ini',
install: 'php',
make: 'ini',
md: 'markdown',
module: 'php',
profile: 'php',
test: 'php',
theme: 'php',
yml: 'yaml'
},
// Router options.
router: {
// Change the route prefix from "/dreditor" to "/review".
prefix: 'review'
}
});
function getAbsoluteUrl(url) {
var a = document.createElement('a');
a.href = url;
return a.href;
}
var patches = document.getElementById('patches');
document.getElementById('load').addEventListener('click', function () {
var url = patches.value || patches.options[patches.selectedIndex].value;
if (!url) window.alert('You must select a patch to load.');
dreditor.navigate(getAbsoluteUrl(url));
}, false);
})(DreditorUI);