summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/report/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/report/utils.js')
-rw-r--r--addons/web/static/src/js/report/utils.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/web/static/src/js/report/utils.js b/addons/web/static/src/js/report/utils.js
new file mode 100644
index 00000000..64776efb
--- /dev/null
+++ b/addons/web/static/src/js/report/utils.js
@@ -0,0 +1,26 @@
+odoo.define('report.utils', function (require) {
+'use strict';
+
+function get_protocol_from_url (url) {
+ var a = document.createElement('a');
+ a.href = url;
+ return a.protocol;
+}
+
+function get_host_from_url (url) {
+ var a = document.createElement('a');
+ a.href = url;
+ return a.host;
+}
+
+function build_origin (protocol, host) {
+ return protocol + '//' + host;
+}
+
+return {
+ 'get_protocol_from_url': get_protocol_from_url,
+ 'get_host_from_url': get_host_from_url,
+ 'build_origin': build_origin,
+};
+
+});