return this.fluidbook.datas.title;
},
- getEmailSubject: function (context) {
+ getEmailSubject: function (url, context) {
if (context === 'publication') {
if (this.fluidbook.datas.email_title === '') {
return this.fluidbook.datas.title;
return this.fluidbook.datas.email_title;
} else if (context === 'product') {
return this.fluidbook.datas.product_email_title;
+ } else if (context === 'article') {
+ return this.getSEOArticle(url).title;
}
},
getEmailBody: function (url, context) {
var body;
var u = this.getShareURL(url);
+ var title = this.fluidbook.datas.title;
if (context === 'publication') {
if (this.fluidbook.datas.email_body === '') {
body = this.fluidbook.l10n.__('Veuillez cliquer sur le lien suivant pour ouvrir %title%\\n%link%');
}
} else if (context === 'product') {
body = this.fluidbook.datas.product_email_body;
+ } else if (context === 'article') {
+ body = '%title%\\n%link%';
+ title = this.getSEOArticle(url).title;
}
body = body.trim();
- body = body.replace(/\%title\%/g, this.fluidbook.datas.title);
+ body = body.replace(/\%title\%/g, title);
if (body.indexOf('%link%') === -1) {
body += "\n\n" + u;
},
getSEOArticle: function (title) {
+ if (title.indexOf('article:') === 0) {
+ title = title.substr(8);
+ }
return this.fluidbook.datas.seoArticles[title];
},
// Generate links
for (var shareType in shareLinks) {
if (shareLinks.hasOwnProperty(shareType)) { // Ensure we don't get inherited properties
- shareHTML += '<li data-level="0"><a href="#" data-service="' + shareType + '" data-url="' + url + '" data-context="'+context+'" class="share level0">';
+ shareHTML += '<li data-level="0"><a href="#" data-service="' + shareType + '" data-url="' + url + '" data-context="' + context + '" class="share level0">';
shareHTML += getSpriteIcon('share-' + shareType);
if (!hideLabels) {
shareHTML += ' ' + shareLinks[shareType];
url = '';
}
if (context === undefined || context === null) {
- context = 'publication';
+ context = url.indexOf('article:') === 0 ? 'article' : 'publication';
}
+
view = '<div class="caption">' + this.fluidbook.menu.closeButton() + '<h2>' + this.fluidbook.l10n.__('share') + '</h2></div>';
view += '<div class="content">';
view += this.getShareLinks(false, url, context);
},
sendEmail: function (url, context) {
- window.location = 'mailto:?subject=' + encodeURIComponent(this.getEmailSubject(context)) + '&body=' + encodeURIComponent(this.getEmailBody(url, context));
+ window.location = 'mailto:?subject=' + encodeURIComponent(this.getEmailSubject(url, context)) + '&body=' + encodeURIComponent(this.getEmailBody(url, context));
this.fluidbook.stats.track(5);
},
sendTwitter: function (url, context) {