PageSourceSearch

https://portal.owncloud.com/core/js/sharedialoglinksocialview.js?v=dd2774748f47720d9deea7a9f29fea34

js owncloud.com collected 2026-10-01 10:18:49 UTC 2,906 bytes, 110 lines download raw bytes

1/*
2 * Copyright (c) 2016
3 *
4 * This file is licensed under the Affero General Public License version 3
5 * or later.
6 *
7 * See the COPYING-README file.
8 *
9 */
10
11(function() {
12	if (!OC.Share) {
13		OC.Share = {};
14	}
15	
16	var TEMPLATE = 
17			'<button class="icon icon-social-twitter pop-up hasTooltip"' +
18			'	title="{{shareToolTipTwitter}}"' +
19			'	data-url="https://twitter.com/intent/tweet?url={{reference}}"></button>' +
20			'<button class="icon icon-social-facebook pop-up hasTooltip"' +
21			'	title="{{shareToolTipFacebook}}"' +
22			'	data-url="https://www.facebook.com/sharer/sharer.php?u={{reference}}"></button>' +
23			'<button class="icon icon-social-diaspora pop-up hasTooltip"' +
24			'	title="{{shareToolTipDiaspora}}"' +
25			'	data-url="https://sharetodiaspora.github.io/?url={{reference}}"></button>' +
26			'<button class="icon icon-mail-grey pop-up hasTooltip"' +
27			'	title="{{shareToolTipMail}}"' +
28			'	data-url="mailto:?body={{reference}}"></button>'
29		;
30	
31	/**
32	 * @class OCA.Share.ShareDialogLinkSocialView
33	 * @member {OC.Share.ShareModel} model
34	 * @member {jQuery} $el
35	 * @memberof OCA.Sharing
36	 * @classdesc
37	 *
38	 * Represents the GUI of the share dialogue
39	 *
40	 */
41	var ShareDialogLinkSocialView = OC.Backbone.View.extend({
42		/** @type {string} **/
43		id: 'shareDialogLinkSocialView',
44
45		/** @type {OC.Share.ShareConfigModel} **/
46		configModel: undefined,
47
48		/** @type {Function} **/
49		_template: undefined,
50
51		events: {
52			"click .pop-up": 'onPopUpClick'
53		},
54
55		initialize: function(options) {
56			var view = this;
57
58			if(!_.isUndefined(options.configModel)) {
59				this.configModel = options.configModel;
60			} else {
61				throw 'missing OC.Share.ShareConfigModel';
62			}
63		},
64
65		onPopUpClick: function(event) {
66			var url = $(event.target).data('url');
67			$(event.target).tooltip('hide');
68			if (url) {
69				var width = 600;
70				var height = 400;
71				var left = (screen.width/2)-(width/2);
72				var top = (screen.height/2)-(height/2);
73
74				window.open(url, 'name', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
75			}
76		},
77
78		render: function() {
79			this.$el.html(this.template({
80				cid: this.cid,
81				reference: this.model.getLink(),
82				shareToolTipTwitter: t('core', 'Share to Twitter. Opens in a new window.'),
83				shareToolTipFacebook: t('core', 'Share to Facebook. Opens in a new window.'),
84				shareToolTipDiaspora: t('core', 'Share to Diaspora. Opens in a new window.'),
85				shareToolTipMail: t('core', 'Share via email. Opens your mail client.')
86			}));
87
88			this.$el.find('.hasTooltip').tooltip({trigger: 'hover'});
89
90			this.delegateEvents();
91
92			return this;
93		},
94
95		/**
96		 * @returns {Function} from Handlebars
97		 * @private
98		 */
99		template: function(data) {
100			if (!this._template) {
101				this._template = Handlebars.compile(TEMPLATE);
102			}
103			return this._template(data);
104		}
105
106	});
107
108	OC.Share.ShareDialogLinkSocialView = ShareDialogLinkSocialView;
109
110})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.