1 | |
---|
2 | /* Use onDOMLoad event to initialize kukit |
---|
3 | earlier then the document is fully loaded, |
---|
4 | but after the DOM is at its place already. |
---|
5 | |
---|
6 | This functionality is missing from Plone 2.1, |
---|
7 | the script is present in >=2.5, but it is not |
---|
8 | always added to RR - it needs to be added manually. |
---|
9 | |
---|
10 | If it's present we use it. |
---|
11 | */ |
---|
12 | |
---|
13 | kukit.plonetabs = {}; |
---|
14 | |
---|
15 | /* Base kukit plugins for plonetabs */ |
---|
16 | |
---|
17 | kukit.actionsGlobalRegistry.register('plonetabs-redirectTo', function(oper) { |
---|
18 | ;;; oper.componentName = '[plonetabs-redirectTo] action'; |
---|
19 | var wl = window.location; |
---|
20 | oper.evaluateParameters([], {'protocol' : wl.protocol, |
---|
21 | 'host' : wl.host, |
---|
22 | 'pathname' : wl.pathname, |
---|
23 | 'search' : wl.search, |
---|
24 | 'hash' : wl.hash}); |
---|
25 | |
---|
26 | // normalize parameters |
---|
27 | var protocol = oper.parms.protocol + (oper.parms.protocol[oper.parms.protocol.length - 1] == ":") ? "" : ":"; |
---|
28 | var host = oper.parms.host; |
---|
29 | var pathname = oper.parms.pathname; |
---|
30 | var search = (oper.parms.search.substr(0, 1) == "?") ? "" : "?" + oper.parms.search; |
---|
31 | var hash = (oper.parms.hash.length > 1) ? ((oper.parms.hash.substr(0, 1) == "#" ? "" : "#") + oper.parms.hash) : ""; |
---|
32 | |
---|
33 | url = protocol + "//" + host + pathname + search + hash; |
---|
34 | window.location.replace(url); |
---|
35 | |
---|
36 | }); |
---|
37 | kukit.commandsGlobalRegistry.registerFromAction('plonetabs-redirectTo', |
---|
38 | kukit.cr.makeSelectorCommand); |
---|
39 | |
---|