<commit_before>define([
	"Ember",
	"nwjs/menu",
	"nwjs/openBrowser",
	"hbs!templates/components/channel/ChannelPanelItemComponent"
], function(
	Ember,
	Menu,
	openBrowser,
	layout
) {

	var get = Ember.get;


	return Ember.Component.extend({
		layout: layout,
		tagName: "li",
		classNames: [ "channel-panel-item-component" ],

		openBrowser: "openBrowser",

		didInsertElement: function() {
			var self = this;

			this.$( "a" )
				.addClass( "external-link" )
				.each(function() {
					this.setAttribute( "title", this.href );
				})
				.click(function( e ) {
					e.preventDefault();
					e.stopImmediatePropagation();
					self.send( "openBrowser", this.href );
				});

			this._super.apply( this, arguments );
		},

		contextMenu: function( event ) {
			var target = event.target;
			if ( target.tagName === "IMG" && target.classList.contains( "withLink" ) ) {
				return this.linkContentMenu( event, get( this, "panel.link" ) );
			}
			if ( target.tagName === "A" && target.classList.contains( "external-link" ) ) {
				return this.linkContentMenu( event, target.href );
			}
		},

		linkContentMenu: function( event, url ) {
			var menu = Menu.create();
			menu.items.pushObject({
				label: "Open in browser",
				click: openBrowser.bind( null, url )
			});

			menu.popup( event );
		},

		actions: {
			"openBrowser": function( url ) {
				this.sendAction( "openBrowser", url );
			}
		}
	});

});
<commit_msg>Fix openBrowser on unlinked ChannelPanelItem image<commit_after>define([
	"Ember",
	"nwjs/menu",
	"nwjs/openBrowser",
	"hbs!templates/components/channel/ChannelPanelItemComponent"
], function(
	Ember,
	Menu,
	openBrowser,
	layout
) {

	var get = Ember.get;


	return Ember.Component.extend({
		layout: layout,
		tagName: "li",
		classNames: [ "channel-panel-item-component" ],

		openBrowser: "openBrowser",

		didInsertElement: function() {
			var self = this;

			this.$( "a" )
				.addClass( "external-link" )
				.each(function() {
					this.setAttribute( "title", this.href );
				})
				.click(function( e ) {
					e.preventDefault();
					e.stopImmediatePropagation();
					self.send( "openBrowser", this.href );
				});

			this._super.apply( this, arguments );
		},

		contextMenu: function( event ) {
			var target = event.target;
			if ( target.tagName === "IMG" && target.classList.contains( "withLink" ) ) {
				return this.linkContentMenu( event, get( this, "panel.link" ) );
			}
			if ( target.tagName === "A" && target.classList.contains( "external-link" ) ) {
				return this.linkContentMenu( event, target.href );
			}
		},

		linkContentMenu: function( event, url ) {
			var menu = Menu.create();
			menu.items.pushObject({
				label: "Open in browser",
				click: openBrowser.bind( null, url )
			});

			menu.popup( event );
		},

		actions: {
			"openBrowser": function( url ) {
				if ( !url ) { return; }
				this.sendAction( "openBrowser", url );
			}
		}
	});

});

{'fraction_non_alphanumeric': 0.1658102089756766, 'fraction_numerical': 0.0, 'mean_word_length': 3.1536273115220483, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3135700', 'n_tokens_mistral': 1180, 'n_tokens_neox': 988, 'n_words': 202}