Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
removed rich copy
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycoates committed Mar 13, 2017
1 parent 67d336b commit 9083057
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 42 deletions.
24 changes: 0 additions & 24 deletions server/src/pages/shot/controller.js
Expand Up @@ -196,30 +196,6 @@ exports.setTitle = function (title) {
req.send(JSON.stringify({ title }));
};

exports.sendRichCopy = function () {
let event = document.createEvent("CustomEvent");
function quote(s) {
s = s+"";
return s.replace(/"/g, '&quot;').replace(/</g, '&gt;').replace(/&/g, '&amp;');
}
let shot = model.shot;
let clip = shot.getClip(shot.clipNames()[0]);
let src = clip.image.url;
let height = clip.image.dimensions.y;
let width = clip.image.dimensions.x;
let adjust = Math.min(500 / width, 350 / height);
if (adjust < 1) {
height = height * adjust;
width = width * adjust;
}
let detail = {
html: `<img src="${quote(src)}" height="${quote(height)}" width="${quote(width)}" /><br /><a href="${quote(shot.viewUrl)}">${quote(shot.title)}</a> (source: <a href="${quote(shot.url)}">${quote(shot.urlDisplay)}</a>)`,
text: `${shot.title}: ${shot.viewUrl} (source: ${shot.url})`
};
event.initCustomEvent("sendRichCopy", true, true, detail);
document.dispatchEvent(event);
};

function render() {
page.render(model);
}
Expand Down
13 changes: 0 additions & 13 deletions server/src/pages/shot/share-buttons.js
Expand Up @@ -20,7 +20,6 @@ exports.ShareButton = class ShareButton extends React.Component {
staticLink={this.props.staticLink}
renderExtensionNotification={this.props.renderExtensionNotification}
isOwner={this.props.isOwner}
sendRichCopy={this.props.sendRichCopy}
isExtInstalled={this.props.isExtInstalled}
/>;
}
Expand Down Expand Up @@ -81,14 +80,6 @@ class ShareButtonPanel extends React.Component {
sendEvent("share", "focus-url");
}

onClickRichCopy(event) {
event.preventDefault();
this.props.sendRichCopy();
sendEvent("share", "rich-copy");
this.props.closePanel();
return false;
}

render() {
let className = "share-panel default-color-scheme";
if (this.props.renderExtensionNotification) {
Expand All @@ -108,10 +99,6 @@ class ShareButtonPanel extends React.Component {
<a title="Create email with link" onClick={ this.onClickShareButton.bind(this, "email") } target="_blank" href={ `mailto:?subject=Fwd:%20${encodeURIComponent(this.props.shot.title)}&body=${encodeURIComponent(this.props.shot.title)}%0A%0A${encodeURIComponent(this.props.shot.viewUrl)}%0A%0ASource:%20${encodeURIComponent(this.props.shot.url)}%0A` }>
<img src={ this.props.staticLink("/static/img/share-email.svg") } />
</a>
{this.props.isExtInstalled ?
<a title="Copy the image and link to the clipboard" onClick={ this.onClickRichCopy.bind(this) } target="_blank" href="#">
<img src={ this.props.staticLink("/static/img/copy.png") } />
</a> : null}
</div>
<p>Get a shareable link to this shot:</p>
<div className="wrapper row-space">
Expand Down
6 changes: 1 addition & 5 deletions server/src/pages/shot/view.js
Expand Up @@ -301,7 +301,7 @@ class Body extends React.Component {
title="Download the shot image" download={ clipFilename }>
<img src={ this.props.staticLink("/static/img/download.svg") } />
</a>
<ShareButton abTests={this.props.abTests} clipUrl={clipUrl} shot={shot} isOwner={this.props.isOwner} staticLink={this.props.staticLink} renderExtensionNotification={renderExtensionNotification} sendRichCopy={this.sendRichCopy.bind(this)} isExtInstalled={this.props.isExtInstalled} />
<ShareButton abTests={this.props.abTests} clipUrl={clipUrl} shot={shot} isOwner={this.props.isOwner} staticLink={this.props.staticLink} renderExtensionNotification={renderExtensionNotification} isExtInstalled={this.props.isExtInstalled} />
</div>
</div>
{ clips }
Expand Down Expand Up @@ -369,10 +369,6 @@ class Body extends React.Component {
sendEvent("start-feedback", "footer", {useBeacon: true});
}

sendRichCopy() {
controller.sendRichCopy();
}

}

class ExpireWidget extends React.Component {
Expand Down

0 comments on commit 9083057

Please sign in to comment.