From 3fec37b1ad2daa6fed8743e27fb04f3955564074 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 7 Feb 2019 19:11:52 +0100 Subject: [PATCH] Add share button support in message share content dialog Close #2845 --- wcfsetup/install/files/js/WCF.Message.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index cdb140c01d..4e2a33171c 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -2181,10 +2181,19 @@ WCF.Message.Share.Content = Class.extend({ */ _dialog: null, + /** + * template containing the social media share buttons + * @var string + */ + _shareButtonsTemplate: '', + /** * Initializes the WCF.Message.Share.Content class. + * + * @param {string?} shareButtonsTemplate */ - init: function() { + init: function(shareButtonsTemplate) { + this._shareButtonsTemplate = shareButtonsTemplate || ''; this._cache = { }; this._dialog = null; @@ -2235,6 +2244,12 @@ WCF.Message.Share.Content = Class.extend({ var $section = $('

').appendTo(this._dialog); $('').attr('value', '' + WCF.String.escapeHTML($title) + '').appendTo($section); + // share buttons + if (this._shareButtonsTemplate !== '') { + $section = $('

' + WCF.Language.get('wcf.message.share') + '

' + this._shareButtonsTemplate + '
').appendTo(this._dialog); + elData($section.children('.jsMessageShareButtons')[0], 'url', WCF.String.escapeHTML($link)); + } + this._cache[$key] = this._dialog.html(); if ($dialogInitialized) { -- 2.20.1