').append($shareIcon).html(),
- options: options,
- feedback: 'SHARE_MENU',
- common: Common
- };
- var $shareBlock = UIElements.createDropdown(dropdownConfigShare);
- $shareBlock.find('.cp-dropdown-content').addClass(SHARE_CLS).addClass(EDITSHARE_CLS).addClass(VIEWSHARE_CLS);
- $shareBlock.addClass('cp-toolbar-share-button');
- $shareBlock.find('button').attr('title', Messages.shareButton);
-
- if (hashes.editHash) {
- $shareBlock.find('a.cp-toolbar-share-edit-copy').click(function () {
- /*Common.storeLinkToClipboard(false, function (err) {
- if (!err) { UI.log(Messages.shareSuccess); }
- });*/
- var url = origin + pathname + '#' + hashes.editHash;
- var success = Clipboard.copy(url);
- if (success) { UI.log(Messages.shareSuccess); }
- });
- }
- if (hashes.viewHash) {
- $shareBlock.find('a.cp-toolbar-share-view-copy').click(function () {
- /*Common.storeLinkToClipboard(true, function (err) {
- if (!err) { UI.log(Messages.shareSuccess); }
- });*/
- var url = origin + pathname + '#' + hashes.viewHash;
- var success = Clipboard.copy(url);
- if (success) { UI.log(Messages.shareSuccess); }
+ pathname: pathname,
+ hashes: hashes,
+ common: Common
});
- $shareBlock.find('a.cp-toolbar-share-view-embed').click(function () {
- var url = origin + pathname + '#' + hashes.viewHash;
- var parsed = Hash.parsePadUrl(url);
- url = origin + parsed.getUrl({embed: true, present: true});
- // Alertify content
- var $content = $('
');
- $('
', {'style':'display:none;'}).appendTo($content);
- $('
').text(Messages.viewEmbedTitle).appendTo($content);
- var $tag = $('
').text(Messages.viewEmbedTag).appendTo($content);
- $('
').appendTo($tag);
- var iframeId = uid();
- var iframeEmbed = '';
- $('', {
- type: 'text',
- id: iframeId,
- readonly: 'readonly',
- value: iframeEmbed,
- }).appendTo($tag);
- UI.alert($content.html(), null, true);
- $('#'+iframeId).click(function () {
- this.select();
- });
- //var success = Clipboard.copy(url);
- //if (success) { UI.log(Messages.shareSuccess); }
- });
- }
+ });
toolbar.$leftside.append($shareBlock);
toolbar.share = $shareBlock;
@@ -574,57 +465,18 @@ define([
var origin = config.metadataMgr.getPrivateData().origin;
var pathname = config.metadataMgr.getPrivateData().pathname;
var hashes = metadataMgr.getPrivateData().availableHashes;
- var url = origin + pathname + '#' + hashes.fileHash;
-
- var $shareIcon = $('', {'class': 'fa fa-share-alt'});
- var options = [];
- options.push({
- tag: 'a',
- attributes: {title: Messages.editShareTitle, 'class': 'cp-toolbar-share-file-copy'},
- content: ' ' + Messages.fileShare
- });
- options.push({
- tag: 'a',
- attributes: {title: Messages.fileEmbedTitle, 'class': 'cp-toolbar-share-file-embed'},
- content: ' ' + Messages.getEmbedCode
+ var $shareBlock = $('