Skip to content

Commit

Permalink
Change title data regex to accommodate new HBO player and improve ana…
Browse files Browse the repository at this point in the history
…lytics
  • Loading branch information
nehalvpatel committed Oct 11, 2016
1 parent 51e9c93 commit 6a90a3b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode/.*
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "HBO Now • Force Resolution",
"version": "1.1.3",
"version": "1.1.4",
"manifest_version": 2,
"description": "Allows you to force 1080p HD video on HBONow.com.",
"icons": {
Expand Down
15 changes: 8 additions & 7 deletions src/bg/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@ function handleRequest(details) {
let allowedResolution = allTabs[details.tabId]["allowedStreams"][details.url];
logData(details.tabId, "Allowed " + allowedResolution + "p.");

chrome.tabs.sendMessage(details.tabId, { "event": "getTitle", "resolution": allowedResolution }, function(content) {
ga("send", "event", {
"eventCategory": "Video",
"eventAction": "Play",
"eventLabel": content["videoTitle"],
"eventValue": allowedResolution
});
chrome.tabs.sendMessage(details.tabId, { "event": "getTitle" }, function(content) {
ga("send", "event", "Video", "Play",
{
"dimension1": content["videoTitle"],
"dimension2": desiredResolution + "p",
"dimension3": allowedResolution + "p"
}
);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/inject/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {

let dataBootstrap = {};
let dataBootstrapRegex;
if ((dataBootstrapRegex = document.documentElement.innerHTML.match(/dataBootstrap = (.*),/)) !== null) {
if ((dataBootstrapRegex = document.documentElement.innerHTML.match(/dataBootstrap = (.*)[;|,]/)) !== null) {
dataBootstrap = JSON.parse(dataBootstrapRegex[1]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/page_action/page_action.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ window.onload = function () {
document.getElementById("nearest").innerText = this.value + "p";

ga("send", "event", {
"eventCategory": "Resolution",
"eventCategory": "DesiredResolution",
"eventAction": "Change",
"eventValue": parseInt(this.value)
"eventLabel": this.value + "p"
});
}
}
Expand Down

0 comments on commit 6a90a3b

Please sign in to comment.