Commits

Mathias Panzenböck committed 066fa86

expander ignores MMB/RMB/LMB+modifer, don't flood notifications on seek in FF

MMB to open expander link in new tab works now

  • Participants
  • Parent commits 8e7fc71

Comments (0)

Files changed (1)

javascripts/magnatune.js

 	}
 
 	function clickExpander (event) {
+		if (event.button !== 0 || event.ctrlKey || event.altKey || event.shiftKey || event.metaKey) {
+			return;
+		}
 		var $self = $(this);
 		var options = $self.data('expander').options;
 		var $self = $(this);
 	}
 }
 
+function hashLoadClick (hash,opts) {
+	return function (event) {
+		if (event.button === 0 && !event.shiftKey && !event.metaKey && !event.ctrlKey && !event.altKey) {
+			Magnatune.Info.load(hash,opts);
+		}
+	};
+}
+
 $.extend(Magnatune, {
 	App: {
 		install: function () {
 				$('#play-progress-container').width() * currentTime / duration)+'px');
 		},
 		_playing: function () {
-			$('#play-text').hide();
+			var $playtext = $('#play-text');
+			var wasplaying = $playtext.css('display') === 'none';
+
+			$playtext.hide();
 			$('#pause-text').show();
 
 			if (this._song &&
+				// firefox fires this event on seeking!
+				(!this._lastSong || this._lastSong.mp3 !== this._song.mp3) &&
 				Magnatune.BrowserFeatures.LocalStorage &&
 				getBoolean('notifications.enabled') &&
 				((window.webkitNotifications &&
 					window.webkitNotifications.createNotification($.browser.mozilla ? absurl("/images/logo.png") : iconUrl, title, description);
 				notification.ondisplay = this._timed_hide_notification;
 				notification.show();
+				this._lastSong = this._song;
 			}
 		},
 		_timed_hide_notification: function () {
 							label: genre.genre,
 							head_attrs: {
 								href: hash,
-								onclick: Magnatune.Info.load.bind(Magnatune.Info,hash,{keeptab:true})
+								onclick: hashLoadClick(hash,{keeptab:true})
 							},
 							render: function (parent) {
 								var artists = this.artists.slice();
 							label: artist.artist,
 							head_attrs: {
 								href: hash,
-								onclick: Magnatune.Info.load.bind(Magnatune.Info,hash,{keeptab:true}),
+								onclick: hashLoadClick(hash,{keeptab:true}),
 								title: artist.artist
 							},
 							render: function (parent) {
 							label: genre.genre,
 							head_attrs: {
 								href: hash,
-								onclick: Magnatune.Info.load.bind(Magnatune.Info,hash,{keeptab:true})
+								onclick: hashLoadClick(hash,{keeptab:true})
 							},
 							render: function (parent) {
 								var albums = this.albums.filter(album_filter.bind(this));
 							head_attrs: {
 								'class': 'album-head',
 								href: hash,
-								onclick: Magnatune.Info.load.bind(Magnatune.Info,hash,{keeptab:true}),
+								onclick: hashLoadClick(hash,{keeptab:true}),
 								ondblclick: Magnatune.Collection.withSongs.bind(Magnatune.Collection, album, function (album) {
 									var songs = album.songs;
 									for (var i = 0; i < songs.length; ++ i) {