Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 2cc80db
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 21:31:25 2015 -0700

    v0.174

commit 279764a
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 21:16:39 2015 -0700

    Decorating during idle as well as trying in mouseEnter if needed

commit 27023fb
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 21:09:32 2015 -0700

    Readding Opera patch for HTML5 video, appears might also be needed

commit e4120f2
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 21:05:59 2015 -0700

    Fixing tooltip appearing

    #510

commit 6ae2498
Merge: d8e404d 7047360
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Thu May 7 20:41:37 2015 -0700

    Merge pull request #515 from cgalvan/upstream

    #510 - Fixed issue with tooltips not displaying on first mouseover.

commit d8e404d
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 20:41:03 2015 -0700

    Added an 'about streamus' menu option

    It's boring for now. has the version/change log/website links in it, but
    I'll spice it up in the future.

commit 7047360
Author: cgalvan1337 <cgalvan1337@gmail.com>
Date:   Thu May 7 16:34:27 2015 -0500

    #510 - Fixed issue with tooltips not displaying on first mouseover.

commit 886685d
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 12:01:47 2015 -0700

    Putting in a few isDestroyed checks and stifling excessive errors

commit 3f26ca8
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 11:51:23 2015 -0700

    Errors not being output because complex type

commit 19a518e
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 11:50:21 2015 -0700

    maxResults isn't needed when providing an array of ids

commit 2b4513c
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 11:26:54 2015 -0700

    Removing 'show video' option until it is ready

commit 82be650
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 11:26:05 2015 -0700

    Adding a comment replace step to grunt

commit b45d75d
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu May 7 09:19:30 2015 -0700

    Fixing an issue with accessing values via eventArgs

    Resolves #512

commit 754d62e
Merge: 7c58964 8c3ec38
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Wed May 6 21:10:35 2015 -0700

    Merge pull request #511 from MeoMix/master

    Merging v0.173 from Development into Master

commit 7c58964
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 21:04:38 2015 -0700

    Revving to v0.173

commit 26a94cc
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 20:00:17 2015 -0700

    Fixing linter

commit fc4cc11
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 19:54:58 2015 -0700

    Patching #404

commit c9138d5
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 18:07:34 2015 -0700

    Resolving #330

commit c50b915
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 16:31:11 2015 -0700

    Resolving #434

commit 98429e6
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 15:12:19 2015 -0700

    Resolving #509

commit ec7bffe
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 15:12:10 2015 -0700

    Updated locale that wasnt in the project

commit 2447c81
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 15:11:57 2015 -0700

    Tightening down jshint and added some ignores where needed for now.

commit 9714a41
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 14:12:31 2015 -0700

    Removing some console logs

commit 9ff2653
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 13:45:40 2015 -0700

    Fixing potential race condition with idle event

commit c291c9f
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 13:30:53 2015 -0700

    Replacing _.defer with RAF where appropriate and removing addt window. references

commit 08b1e3e
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 12:04:14 2015 -0700

    Removing unused CSS

commit bcb0a3e
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 12:03:57 2015 -0700

    Resolving #507

commit c51e0e5
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 11:55:38 2015 -0700

    Cleanup and comment

commit 78a6adb
Merge: f248427 1183496
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 11:50:19 2015 -0700

    Merging pr/504

commit f248427
Merge: 413dc96 e3f39e0
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 11:39:09 2015 -0700

    Merge branch 'pr/503' into Development

commit e3f39e0
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 11:38:49 2015 -0700

    Fixing merge conflict

commit 413dc96
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 11:34:03 2015 -0700

    Merging openInTab command PR + cleaning up locales

commit 1183496
Author: jcme <holmes.jc@gmail.com>
Date:   Wed May 6 19:32:42 2015 +0100

    Moving key down event handler to foreground Area View - using commands channel to communicate

commit c30b5f4
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed May 6 00:06:31 2015 -0700

    Fixing jshint

commit 190ff74
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Tue May 5 23:45:33 2015 -0700

    Added some unfinished code for showing video, commented out.

commit 10a1a8d
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Tue May 5 22:27:26 2015 -0700

    Fixing broken test case setup

commit 72b5efb
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Tue May 5 22:25:17 2015 -0700

    Omnibox actually only shows 5 results not 6

commit a7b335c
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:26:32 2015 -0700

    Update README.md

commit 888f05a
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:25:39 2015 -0700

    Update README.md

commit 0150e62
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:25:21 2015 -0700

    Update README.md

commit 362f34b
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:24:13 2015 -0700

    Update README.md

commit 1a8c67a
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:23:04 2015 -0700

    Update README.md

commit 7204eef
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:22:12 2015 -0700

    Update README.md

commit 8e1a890
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:21:59 2015 -0700

    Update README.md

commit 6da6285
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:21:09 2015 -0700

    Update README.md

commit d2278b0
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:19:31 2015 -0700

    Update README.md

commit af8f205
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:18:30 2015 -0700

    Update README.md

commit 135f7f9
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 20:18:01 2015 -0700

    Update README.md

commit 1c5ee65
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:46:47 2015 -0700

    Update README.md

commit bef5d80
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:45:11 2015 -0700

    Update README.md

commit 532b1a7
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:44:11 2015 -0700

    Update README.md

commit cd4faef
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:39:54 2015 -0700

    Update README.md

commit 43d467b
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:35:05 2015 -0700

    Update README.md

commit 018c983
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:29:16 2015 -0700

    Update README.md

commit 4a51d23
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:20:58 2015 -0700

    Update README.md

commit 15722da
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:08:26 2015 -0700

    Update README.md

commit ea20b65
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:00:48 2015 -0700

    Update README.md

commit 031c486
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 19:00:12 2015 -0700

    Update README.md

commit 02c6054
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 18:59:33 2015 -0700

    Update README.md

commit e0fa8de
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 18:58:37 2015 -0700

    Update README.md

commit f61fb35
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 18:57:59 2015 -0700

    Update README.md

commit 1f4d1e2
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Tue May 5 18:57:18 2015 -0700

    Working on cleaning up the ReadMe a bit.

commit e5a084c
Merge: 6ddda20 1b1c33d
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Mon May 4 16:45:16 2015 -0700

    Merge pull request #505 from jcme/patch-2

    Force UI to full size if loaded in new tab

commit 1b1c33d
Author: jcme <holmes.jc@gmail.com>
Date:   Mon May 4 22:20:50 2015 +0100

    Force UI to full size if loaded in new tab

commit 8ebef70
Author: jcme <holmes.jc@gmail.com>
Date:   Mon May 4 17:03:53 2015 +0100

    Allows space bar to toggle player state

commit 6d458af
Author: jcme <holmes.jc@gmail.com>
Date:   Sun May 3 00:11:23 2015 +0100

    Implement a keyboard shortcut to open Streamus in a new tab

commit 6ddda20
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed Apr 29 18:28:27 2015 -0700

    Fixing #415

commit 439b860
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Wed Apr 29 18:07:33 2015 -0700

    Content script refactor/cleanup, bug fix for flexbox

commit 5cf857f
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Mon Apr 27 15:32:03 2015 -0700

    Forgot to set threshold back to 10

commit 4debdf7
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Mon Apr 27 15:31:30 2015 -0700

    Major cleanup

    - Rewrote a lot of the Scrollable logic so that it's more performant. No
    need for the throttling.
    - Moved all the scrollable logic into one behavior instead of scattered.
    - Rewrote large chunks of slidingRender to be more performant and fix a
    few trailing bugs.

commit 300fa82
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Fri Apr 24 10:56:56 2015 -0700

    Removing comment

commit 9b88f87
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu Apr 23 23:09:03 2015 -0700

    Applying a lot of the enhancements made in Marionette v2.4

commit 0572009
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu Apr 23 22:12:26 2015 -0700

    Cleaning up grunt and manifest

commit 4bad75a
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu Apr 23 16:52:10 2015 -0700

    Fixing grunt file

commit 833e04c
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu Apr 23 15:20:47 2015 -0700

    Typos and clarification on comments

commit 31413e7
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu Apr 23 15:16:47 2015 -0700

    More comments

commit dce112c
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Thu Apr 23 15:10:01 2015 -0700

    Refactoring

    - Rewrote youTubeIFrameInject.js so that it's OOP and w/o dependencies
    on jQuery
    - Minor perf. improvements throughout with will-change CSS property and
    proper defer load of non-critical views
    - Removed check for Flash loaded and heavy-handed forcing load of HTML5
    <video>.

commit 1fb0f09
Merge: 60635e9 f741c19
Author: Sean Anderson <Meo.DDR@gmail.com>
Date:   Thu Apr 23 00:28:23 2015 -0700

    Merge pull request #480 from trsouz/Translate/pt_BR

    Brazilian Portuguese translation locale added

commit f741c19
Author: Thiago Rodrigues <thiagorsouz@gmail.com>
Date:   Wed Apr 15 23:34:43 2015 -0300

    Translating to Brazilian Portuguese

commit 60635e9
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Mon Mar 30 17:09:10 2015 -0700

    Fixing event handlers

commit c74ee36
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Sun Mar 29 16:31:27 2015 -0700

    Refactoring

commit a0a3072
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Sat Mar 28 14:57:47 2015 -0700

    Defering requireJS just in case

commit 4324c0e
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Tue Mar 24 22:16:36 2015 -0700

    Adding some performance hacks by deferring initial view loading where possible

commit 2c4d45b
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Tue Mar 24 19:50:20 2015 -0700

    Also remove permission when not needed

commit 2b004d9
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Tue Mar 24 19:18:53 2015 -0700

    Making the beatport inject code optional

    #450

commit b7fa7b1
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Tue Mar 24 17:53:34 2015 -0700

    Fixing #467

commit 71b3fc3
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Tue Mar 24 17:44:27 2015 -0700

    Adding support for bulk add event to improve performance

commit 048de1d
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Tue Mar 24 13:09:04 2015 -0700

    Fixing a bug with youtube inject

commit 1358507
Author: Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Date:   Mon Mar 23 19:37:01 2015 -0700

    Fixing issue where I'd delete the translation for Opera locales
  • Loading branch information
MeoMix committed May 8, 2015
1 parent 8c3ec38 commit ef9aed6
Show file tree
Hide file tree
Showing 27 changed files with 280 additions and 79 deletions.
6 changes: 5 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ module.exports = function(grunt) {
to: 'localDebug: false'
}]
},
// Replace debugging and non-concatenated file references in manifest.json
// Remove development key and comments from manifest for deployment
transformManifest: {
src: ['dist/manifest.json'],
overwrite: true,
Expand All @@ -161,6 +161,10 @@ module.exports = function(grunt) {
// Don't remove key when testing because server will throw CORS errors.
return isDebug ? match : '';
}
}, {
// Remove comments because they can't be uploaded to the web store.
from: /\/\/ .*/ig,
to: ''
}]
}
},
Expand Down
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ v0.169
- 'Add to Streamus' button now selects your current playlist by default
- Search Results now filter out songs which have been marked as not playable outside of YouTube.com. This should help alleviate some of the "Song cannot be played in embedded player" errors.
- Playlist 0000 has been renamed to New Playlist
- The playlists panel will now remember its scroll position even after Streamus has been closed and re-opened. Remembering the position for Playlist Items will come in the future.
- The playlists panel will now remember its scroll position even after Streamus has been closed and re-opened. Remembering the position for Playlist Items will come in the future.
15 changes: 15 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -524,5 +524,20 @@
},
"playlistUrl": {
"message": "Playlist URL"
},
"aboutStreamus": {
"message": "About Streamus"
},
"applicationDetails": {
"message": "Application details"
},
"openHomepage": {
"message": "Open homepage"
},
"version": {
"message": "Version"
},
"openPatchNotes": {
"message": "Open patch notes"
}
}
4 changes: 4 additions & 0 deletions src/js/background/model/tabManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
});
},

showWebsite: function(url) {
this._showTab(url);
},

showStreamusTab: function() {
this._showTab(this.get('streamusForegroundUrl'));
},
Expand Down
1 change: 0 additions & 1 deletion src/js/background/model/youTubeV3API.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@
complete: options.complete
}, {
part: 'contentDetails, snippet, status',
maxResults: 50,
id: options.songIds.join(','),
fields: 'items/id, items/contentDetails/duration, items/snippet/title, items/snippet/channelTitle, items/status/embeddable'
});
Expand Down
34 changes: 34 additions & 0 deletions src/js/background/view/youTubePlayerView.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,40 @@
refererRequestHeader.value = referer;
}

// Opera does not default to using the HTML5 player because of lack of MSE support.
// Modify user's preferences being sent to YouTube to imply that the user wants HTML5 only
// This will cause preferences to go from looking like PREF=al=en&f1=50000000&f5=30; to PREF=al=en&f1=50000000&f5=30&f2=40000000;
var isOpera = navigator.userAgent.indexOf(' OPR/') >= 0;
if (isOpera) {
var html5PrefValue = 'f2=40000000';
var cookieRequestHeader = this._getHeader(info.requestHeaders, 'Cookie');

if (_.isUndefined(cookieRequestHeader)) {
info.requestHeaders.push({
name: 'Cookie',
value: 'PREF=' + html5PrefValue
});
} else {
// Try to find PREF:
var cookieValue = cookieRequestHeader.value;
var prefStartIndex = cookieValue.indexOf('PREF');

// Failed to find any preferences, so provide full pref string
if (prefStartIndex === -1) {
cookieRequestHeader.value = cookieValue + '; PREF=' + html5PrefValue + ';';
} else {
var prefEndIndex = cookieValue.indexOf(';', prefStartIndex);

// Don't try to handle malformed preferences, too difficult.
if (prefEndIndex !== -1) {
// Inject custom preference value
var modifiedPref = cookieValue.slice(0, prefEndIndex) + '&' + html5PrefValue + cookieValue.slice(prefEndIndex);
cookieRequestHeader.value = modifiedPref;
}
}
}
}

return { requestHeaders: info.requestHeaders };
},

Expand Down
2 changes: 1 addition & 1 deletion src/js/contentScript/youTubeIFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
// Include any errors encountered to help with debugging.
this.notifyYouTubeLoadFailure = function() {
this.port.postMessage({
error: 'videoStream not found. Errors: ' + this.errors.join(', ')
error: 'videoStream not found. Errors: ' + JSON.stringify(this.errors)
});
}.bind(this);

Expand Down
46 changes: 26 additions & 20 deletions src/js/foreground/view/appBar/adminMenuAreaView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

var SettingsDialogView = require('foreground/view/dialog/settingsDialogView');
var BrowserSettingsDialogView = require('foreground/view/dialog/browserSettingsDialogView');
var AboutStreamusDialogView = require('foreground/view/dialog/aboutStreamusDialogView');
var AdminMenuAreaTemplate = require('text!template/appBar/adminMenuArea.html');
var SettingsIcon = require('text!template/icon/settingsIcon_24.svg');

Expand All @@ -15,29 +16,30 @@
browserSettingsMessage: chrome.i18n.getMessage('browserSettings'),
keyboardShortcutsMessage: chrome.i18n.getMessage('keyboardShortcuts'),
openInTabMessage: chrome.i18n.getMessage('openInTab'),
aboutStreamusMessage: chrome.i18n.getMessage('aboutStreamus'),
reloadMessage: chrome.i18n.getMessage('reload'),
settingsIcon: SettingsIcon
},

ui: function() {
return {
menuButton: '#' + this.id + '-menuButton',
menu: '#' + this.id + '-menu',
settingsMenuItem: '#' + this.id + '-settingsMenuItem',
browserSettingsMenuItem: '#' + this.id + '-browserSettingsMenuItem',
openInTabMenuItem: '#' + this.id + '-openInTabMenuItem',
keyboardShortcutsMenuItem: '#' + this.id + '-keyboardShortcutsMenuItem',
restartMenuItem: '#' + this.id + '-reloadMenuItem'
};
ui: {
menuButton: '.menuButton',
menu: '.menu',
settings: '.settings',
browserSettings: '.browserSettings',
openInTab: '.openInTab',
keyboardShortcuts: '.keyboardShortcuts',
aboutStreamus: '.aboutStreamus',
restart: '.reload'
},

events: {
'click @ui.menuButton': '_onClickMenuButton',
'click @ui.settingsMenuItem': '_onClickSettingsMenuItem',
'click @ui.browserSettingsMenuItem': '_onClickBrowserSettingsMenuItem',
'click @ui.keyboardShortcutsMenuItem': '_onClickKeyboardShortcutsMenuItem',
'click @ui.openInTabMenuItem': '_onClickOpenInTabMenuItem',
'click @ui.restartMenuItem': '_onClickRestartMenuItem'
'click @ui.settings': '_onClickSettings',
'click @ui.browserSettings': '_onClickBrowserSettings',
'click @ui.keyboardShortcuts': '_onClickKeyboardShortcuts',
'click @ui.openInTab': '_onClickOpenInTab',
'click @ui.aboutStreamus': '_onClickAboutStreamus',
'click @ui.restart': '_onClickRestart'
},

modelEvents: {
Expand All @@ -60,23 +62,27 @@
this.model.set('menuShown', !this.model.get('menuShown'));
},

_onClickSettingsMenuItem: function() {
_onClickSettings: function() {
Streamus.channels.dialog.commands.trigger('show:dialog', SettingsDialogView);
},

_onClickBrowserSettingsMenuItem: function() {
_onClickBrowserSettings: function() {
Streamus.channels.dialog.commands.trigger('show:dialog', BrowserSettingsDialogView);
},

_onClickKeyboardShortcutsMenuItem: function() {
_onClickKeyboardShortcuts: function() {
this.tabManager.showKeyboardShortcutsTab();
},

_onClickOpenInTabMenuItem: function() {
_onClickOpenInTab: function() {
this.tabManager.showStreamusTab();
},

_onClickRestartMenuItem: function() {
_onClickAboutStreamus: function() {
Streamus.channels.dialog.commands.trigger('show:dialog', AboutStreamusDialogView);
},

_onClickRestart: function() {
Streamus.backgroundPage.chrome.runtime.reload();
},

Expand Down
37 changes: 20 additions & 17 deletions src/js/foreground/view/behavior/slidingRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,25 +359,28 @@
// Use _.defer to wait for the view to remove the element corresponding to item.
// _renderElementAtIndex has an off-by-one error if executed immediately.
_.defer(function() {
// When a rendered view is lost - render the next one since there's a spot in the viewport
// Note that I'm checking to see if options.index is rendered rather than giving it to _renderElementAtIndex.
if (this._indexWithinRenderRange(options.index)) {
var rendered = this._tryRenderElementAtIndex(this.maxRenderIndex);

// If failed to render next item and there are previous items waiting to be rendered, slide view back 1 item
if (!rendered && this.minRenderIndex > 0) {
// Also ensure that the last item in the view is fully visible before doing the math for scrolling up.
var childContainerTotalHeight = this.childContainerHeight + this.childContainerTranslateY;
// Determine what fraction of childViewHeight is still outside of the viewport.
var offsetToBottom = childContainerTotalHeight - this.lastScrollTop - this.viewportHeight;
// Scroll up one item at max. Reduce the scroll amount by amount needed to force the last item into full view.
var scrollTop = this.lastScrollTop - this.childViewHeight + offsetToBottom;
this.el.scrollTop = scrollTop;
// Any function which is deferred can potentially be ran after the view is destroyed.
if (!this.view.isDestroyed) {
// When a rendered view is lost - render the next one since there's a spot in the viewport
// Note that I'm checking to see if options.index is rendered rather than giving it to _renderElementAtIndex.
if (this._indexWithinRenderRange(options.index)) {
var rendered = this._tryRenderElementAtIndex(this.maxRenderIndex);

// If failed to render next item and there are previous items waiting to be rendered, slide view back 1 item
if (!rendered && this.minRenderIndex > 0) {
// Also ensure that the last item in the view is fully visible before doing the math for scrolling up.
var childContainerTotalHeight = this.childContainerHeight + this.childContainerTranslateY;
// Determine what fraction of childViewHeight is still outside of the viewport.
var offsetToBottom = childContainerTotalHeight - this.lastScrollTop - this.viewportHeight;
// Scroll up one item at max. Reduce the scroll amount by amount needed to force the last item into full view.
var scrollTop = this.lastScrollTop - this.childViewHeight + offsetToBottom;
this.el.scrollTop = scrollTop;
}
}
}

this._setHeightTranslateY();
this.view.triggerMethod('UpdateScrollbar');
this._setHeightTranslateY();
this.view.triggerMethod('UpdateScrollbar');
}
}.bind(this));
},

Expand Down
17 changes: 16 additions & 1 deletion src/js/foreground/view/behavior/sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@
'mouseenter': '_onMouseEnter'
},

initialize: function() {
this.listenTo(Streamus.channels.foregroundArea.vent, 'idle', this._onForegroundAreaIdle);
},

_onForegroundAreaIdle: function() {
this._decorate();
},

_onMouseEnter: function () {
this._decorate();
},

_decorate: function() {
// There's no reason to take this perf hit unless the user is actually going to use sortable logic.
// So, only run it once the user could potentially need to do so.
if (!this.isDecorated) {
Expand All @@ -22,7 +34,10 @@
this.ui.childContainer.sortable(this._getSortableOptions());

this.$el.scroll(_.throttle(function() {
this.ui.childContainer.sortable('refresh');
// Any function which is throttled can potentially be ran after the view is destroyed.
if (!this.view.isDestroyed) {
this.ui.childContainer.sortable('refresh');
}
}.bind(this), 20));
}
},
Expand Down
8 changes: 7 additions & 1 deletion src/js/foreground/view/behavior/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ define(function() {
// Defer applying tooltips until absolutely necessary for rendering performance.
if (!this.isDecorated) {
this.isDecorated = true;

// Wrap in a RAF to allow for :hover effects to take place which might affect whether textTooltipable overflows or not.
requestAnimationFrame(this._setTooltips.bind(this));
requestAnimationFrame(function() {
this._setTooltips.bind(this);
// This forces a tooltip to appear immediately if it exists. This is necessary because decorating
// the element has been delayed until mouseenter for performance, but that is when tooltip rendering triggers, too
this.$el.qtip('toggle', true);
}.bind(this));
}
},

Expand Down
4 changes: 2 additions & 2 deletions src/js/foreground/view/contextMenu/contextMenuItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
var ContextMenuItemView = Marionette.ItemView.extend({
tagName: 'li',
className: function() {
var className = 'listItem listItem--small js-tooltipable';
var className = 'listItem listItem--small listItem--clickable js-tooltipable';
className += this.model.get('disabled') ? ' is-disabled' : '';
return className;
},
template: _.template(ContextMenuItemTemplate),

events: {
'click': '_onClick',
'click': '_onClick'
},

attributes: function() {
Expand Down
22 changes: 22 additions & 0 deletions src/js/foreground/view/dialog/aboutStreamusDialogView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
define(function(require) {
'use strict';

var Dialog = require('foreground/model/dialog');
var AboutStreamusView = require('foreground/view/dialog/aboutStreamusView');
var DialogView = require('foreground/view/dialog/dialogView');

var AboutStreamusDialogView = DialogView.extend({
id: 'aboutStreamusDialog',

initialize: function() {
this.model = new Dialog();

this.contentView = new AboutStreamusView({
});

DialogView.prototype.initialize.apply(this, arguments);
}
});

return AboutStreamusDialogView;
});
48 changes: 48 additions & 0 deletions src/js/foreground/view/dialog/aboutStreamusView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
define(function(require) {
'use strict';

var DialogContentView = require('foreground/view/dialog/dialogContentView');
var AboutStreamusTemplate = require('text!template/dialog/aboutStreamus.html');

var AboutStreamusView = DialogContentView.extend({
id: 'aboutStreamus',
template: _.template(AboutStreamusTemplate),

templateHelpers: {
applicationDetails: chrome.app.getDetails(),
applicationDetailsMessage: chrome.i18n.getMessage('applicationDetails'),
openHomepageMessage: chrome.i18n.getMessage('openHomepage'),
versionMessage: chrome.i18n.getMessage('version'),
openPatchNotesMessage: chrome.i18n.getMessage('openPatchNotes')
},

ui: {
openHomepage: '.openHomepage',
openPatchNotes: '.openPatchNotes'
},

events: {
'click @ui.openHomepage': '_onClickOpenHomepage',
'click @ui.openPatchNotes': '_onClickOpenPatchNotes'
},

tabManager: null,

initialize: function() {
this.tabManager = Streamus.backgroundPage.tabManager;
},

_onClickOpenHomepage: function() {
/* jshint camelcase: false */
var homepageUrl = chrome.app.getDetails().homepage_url;
/* jshint camelcase: true */
this.tabManager.showWebsite(homepageUrl);
},

_onClickOpenPatchNotes: function() {
this.tabManager.showWebsite('https://github.com/MeoMix/StreamusChromeExtension/releases');
}
});

return AboutStreamusView;
});

0 comments on commit ef9aed6

Please sign in to comment.