From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- .../static/src/js/website_links_menu.js | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 addons/website_links/static/src/js/website_links_menu.js (limited to 'addons/website_links/static/src/js/website_links_menu.js') diff --git a/addons/website_links/static/src/js/website_links_menu.js b/addons/website_links/static/src/js/website_links_menu.js new file mode 100644 index 00000000..6f673223 --- /dev/null +++ b/addons/website_links/static/src/js/website_links_menu.js @@ -0,0 +1,26 @@ +/** + * The purpose of this script is to copy the current URL of the website + * into the URL form of the URL shortener (module website_links) + * when the user clicks the link "Share this page" on top of the page. + */ + +odoo.define('website_links.website_links_menu', function (require) { +'use strict'; + +var publicWidget = require('web.public.widget'); +var websiteNavbarData = require('website.navbar'); + +var WebsiteLinksMenu = publicWidget.Widget.extend({ + + /** + * @override + */ + start: function () { + this.$el.attr('href', '/r?u=' + encodeURIComponent(window.location.href)); + return this._super.apply(this, arguments); + }, +}); + +websiteNavbarData.websiteNavbarRegistry.add(WebsiteLinksMenu, '#o_website_links_share_page'); + +}); -- cgit v1.2.3