Skip to content

Commit

Permalink
fix: zeit feedback changes for whatsapp and twitter.
Browse files Browse the repository at this point in the history
  • Loading branch information
nistormihai committed Mar 22, 2016
1 parent cda6c44 commit 71d7143
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define({
'&description=%s',

// Twitter URL, params: message, blog title, permanent link
twt: '//twitter.com/home?status=' + '%s',
twt: '//twitter.com/intent/tweet?via=zeitonline&url=%s&text=%s',

// LinkedIn URL, params: permanent link, blog title, summary
lin: '//www.linkedin.com/shareArticle?mini=true&url=%s&title=%s&summary=%s',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,19 @@ define([
fbURLImageComp += gt.sprintf(shareConf.fbURLImageComp,
[index, Backbone.$(this).attr('src')]);
});
var content = view.model.get('Content');

var content = fixedEncodeURIComp(view.model.get('Content'));
// on zeit request:
// <b>, <strong>, <em>, <i> and <a> tags should be removed while leaving the text they're wrapped around.
content = content.replace(/<(b|strong|em|i|a)\b[^>]*>(.*?)<\/\1>/ig, '$2');
// all other tags should be removed including the text they're wrapped around.
content = content.replace(/<([a-z][a-z0-9]*)\b[^>]*>(.*?)<\/\1>/ig, '');
// encode it properly.
content = fixedEncodeURIComp(content);

var urlParams = {
pin: [permLink, imgsrc, blogTitle],
twt: [permLink],
twt: [permLink, ''],
lin: [permLink, blogTitle, summary],
ggl: [permLink],
email: [gt.gettext('Check out this Live Blog'), permLink],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define({
'&description=%s',

// Twitter URL, params: message, blog title, permanent link
twt: '//twitter.com/home?status=' + '%s',
twt: '//twitter.com/intent/tweet?via=zeitonline&url=%s&text=%s',

// LinkedIn URL, params: permanent link, blog title, summary
lin: '//www.linkedin.com/shareArticle?mini=true&url=%s&title=%s&summary=%s',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,19 @@ define([
fbURLImageComp += gt.sprintf(shareConf.fbURLImageComp,
[index, Backbone.$(this).attr('src')]);
});
var content = view.model.get('Content');

var content = fixedEncodeURIComp(view.model.get('Content'));
// on zeit request:
// <b>, <strong>, <em>, <i> and <a> tags should be removed while leaving the text they're wrapped around.
content = content.replace(/<(b|strong|em|i|a)\b[^>]*>(.*?)<\/\1>/ig, '$2');
// all other tags should be removed including the text they're wrapped around.
content = content.replace(/<([a-z][a-z0-9]*)\b[^>]*>(.*?)<\/\1>/ig, '');
// encode it properly.
content = fixedEncodeURIComp(content);

var urlParams = {
pin: [permLink, imgsrc, blogTitle],
twt: [permLink],
twt: [permLink, ''],
lin: [permLink, blogTitle, summary],
ggl: [permLink],
email: [gt.gettext('Check out this Live Blog'), permLink],
Expand Down

0 comments on commit 71d7143

Please sign in to comment.