From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- addons/web/static/src/js/report/utils.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 addons/web/static/src/js/report/utils.js (limited to 'addons/web/static/src/js/report/utils.js') 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, +}; + +}); -- cgit v1.2.3