Skip to content

Commit ea1ef52

Browse files
committed
🎨 Clean up;
1 parent 40890b9 commit ea1ef52

1 file changed

Lines changed: 46 additions & 36 deletions

File tree

Horizon_TV_Fixer/155147.user.js

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,78 +16,83 @@
1616
// @include *horizon.tv*
1717
// ==/UserScript==
1818

19-
(function HorizonTVFixer(){
19+
(function HorizonTVFixer() {
2020

21-
if(!unsafeWindow.BBVSettingsObject){ return; } // ignore iframes;
21+
// ignore iframes;
22+
if (!unsafeWindow.BBVSettingsObject) {
23+
return;
24+
}
2225

2326
console.log("Version: " + unsafeWindow.BBVSettingsObject.version.major + "." + unsafeWindow.BBVSettingsObject.version.minor + "." + unsafeWindow.BBVSettingsObject.version.micro);
2427

2528
/* Social share & Program/Film info; */
2629
var url = location.href,
2730
socials = {
2831
Google: {
29-
submit: function(title, subtitle, channel, time){
32+
submit: function(title, subtitle, channel, time) {
3033
return "https://www.google.nl/search?q=" + encodeURIComponent(title + (subtitle ? ", " + subtitle : ""));
3134
},
3235
icon: "https://www.google.nl/favicon.ico"
3336
},
3437
IMDb: {
35-
submit: function(title, subtitle, channel, time){
38+
submit: function(title, subtitle, channel, time) {
3639
return "http://www.imdb.com/find?q=" + encodeURIComponent((title + (subtitle ? " - " + subtitle : "")).trim());
3740
},
3841
icon: "https://secure.imdb.com/images/SFff39adb4d259f3c3fd166853a6714a32/legacy/favicon.ico"
3942
},
4043
YouTube: {
41-
submit: function(title, subtitle, channel, time){
44+
submit: function(title, subtitle, channel, time) {
4245
return "https://youtube.com/results?search_query=" + encodeURIComponent((title + (subtitle ? " - " + subtitle : "")).trim());
4346
},
4447
icon: "https://youtube.com/favicon.ico"
4548
},
4649
Twitter: {
47-
submit: function(title, subtitle, channel, time){
50+
submit: function(title, subtitle, channel, time) {
4851
return "https://twitter.com/intent/tweet?original_referer=" + encodeURIComponent(url) +
49-
"&source=tweetbutton&url=" + encodeURIComponent(url) +
50-
"&text=" + encodeURIComponent(title + (subtitle ? " - " + subtitle : "") + " op " + channel + " om " + time + " -");
52+
"&source=tweetbutton&url=" + encodeURIComponent(url) +
53+
"&text=" + encodeURIComponent(title + (subtitle ? " - " + subtitle : "") + " op " + channel + " om " + time + " -");
5154
},
5255
icon: "https://twitter.com/favicon.ico"
5356
},
5457
"Uitzending Gemist": {
55-
submit: function(title, subtitle, channel, time){
58+
submit: function(title, subtitle, channel, time) {
5659
return "http://www.uitzendinggemist.nl/zoek?q=" + encodeURIComponent((title + (subtitle ? " - " + subtitle : "")).trim());
5760
},
5861
icon: "https://mijn.npo.nl/favicon.ico"
5962
},
6063
KijkWijzer: {
61-
submit: function(title, subtitle, channel, time){
64+
submit: function(title, subtitle, channel, time) {
6265
return "http://www.kijkwijzer.nl/index.php?id=3__i&searchfor=" + encodeURIComponent((title + (subtitle ? " - " + subtitle : "")).trim());
6366
},
6467
icon: "http://www.kijkwijzer.nl/favicon.ico"
6568
},
6669
IPTorrents: {
67-
submit: function(title, subtitle, channel, time){
70+
submit: function(title, subtitle, channel, time) {
6871
return "https://iptorrents.com/torrents?q=" + encodeURIComponent(title.trim());
6972
},
7073
icon: "https://iptorrents.com/favicon.ico"
7174
}
7275
};
73-
var _orion_modules_EPG_ListingsView_prototype_showDetails = unsafeWindow.orion.modules.EPG.ListingsView.prototype.showDetails; // https://www.horizon.tv/etc/designs/orion/upc/js/orion/modules/EPG/ListingsView.js?v=34
74-
unsafeWindow.orion.modules.EPG.ListingsView.prototype.showDetails = function(imi){
75-
_orion_modules_EPG_ListingsView_prototype_showDetails.apply(this, arguments); // execute original code;
76+
var _orion_modules_EPG_ListingsView_prototype_showDetails = unsafeWindow.orion.modules.EPG.ListingsView.prototype.showDetails; // https://www.horizon.tv/etc/designs/orion/upc/js/orion/modules/EPG/ListingsView.js?v=34
77+
unsafeWindow.orion.modules.EPG.ListingsView.prototype.showDetails = function(imi) {
78+
_orion_modules_EPG_ListingsView_prototype_showDetails.apply(this, arguments); // execute original code;
7679

7780
var $listing = unsafeWindow.$('.listing[data-listing-id="' + imi + '"]'),
7881
$channel = $listing.closest('.channel-listing'),
7982
station = $channel.get(0),
8083
wrap = station.nextSibling;
81-
if(wrap.classList.contains("done-social")) return; // ignore clicking multiple times on the same program;
84+
if (wrap.classList.contains("done-social")) return; // ignore clicking multiple times on the same program;
8285
wrap.classList.add("done-social");
8386
var details = wrap.querySelector(".details"),
8487
title = details.querySelector("h3").textContent,
85-
subtitle = (details.querySelector("h4") || { textContent: "" }).textContent,
88+
subtitle = (details.querySelector("h4") || {
89+
textContent: ""
90+
}).textContent,
8691
channel = details.querySelector(".channel-details").textContent.split(", ");
8792
var messageDiv = document.createElement("div");
8893
messageDiv.style.marginTop = "12px";
8994
details.appendChild(messageDiv);
90-
for(var key in socials){
95+
for (var key in socials) {
9196
var social = socials[key],
9297
socialA = document.createElement("a"),
9398
socialImg = document.createElement("img"),
@@ -119,12 +124,14 @@
119124

120125
/* Style fixes; */
121126
addStyle(
122-
/* removed white header; */ "\
127+
/* removed white header; */
128+
"\
123129
.servicenav.service { \
124130
display: none; \
125-
} "+
131+
} " +
126132

127-
/* cropped header; */ "\
133+
/* cropped header; */
134+
"\
128135
.header-options { \
129136
margin-top: 0px !important; \
130137
} \
@@ -149,9 +156,10 @@
149156
} \
150157
.channel-guide .gids-panel .current-time:before { \
151158
top: -42px; \
152-
} "+
159+
} " +
153160

154-
/* lower listings; */ "\
161+
/* lower listings; */
162+
"\
155163
.channel-listing .listings, \
156164
.channel-listing .listings .listing, \
157165
.channel-listing .listings .listing.active, \
@@ -171,20 +179,22 @@
171179
.network .logo-active-image { \
172180
max-height: 29px; \
173181
transform: inherit; \
174-
} "+
182+
} " +
175183

176-
/* smaller font size in listing; */ "\
184+
/* smaller font size in listing; */
185+
"\
177186
.channel-listing .listings .listing .title { \
178187
font-size: 12px; \
179-
} "+
188+
} " +
180189

181-
/* hide bottom bar; */ "\
190+
/* hide bottom bar; */
191+
"\
182192
.MyOrionBar { \
183193
display: none; \
184-
} "+
185-
"");
194+
} " +
195+
"");
186196

187-
function addStyle(css){
197+
function addStyle(css) {
188198
var heads = document.getElementsByTagName("head");
189199
if (heads.length > 0) {
190200
var node = document.createElement("style");
@@ -194,18 +204,18 @@
194204
}
195205
}
196206

197-
function PageLoad(done){
198-
if(unsafeWindow.$){
207+
function PageLoad(done) {
208+
if (unsafeWindow.$) {
199209
//unsafeWindow.$(function(){console.log("events: ", unsafeWindow.$(".channel-guide").data("events") );});
200-
unsafeWindow.$(".channel-guide").on("loaded", done); // only on-page jQuery can catch this event;
210+
unsafeWindow.$(".channel-guide").on("loaded", done); // only on-page jQuery can catch this event;
201211
}
202212
}
203213

204-
function ForEachListing(name, done){
205-
PageLoad(function(){
206-
var listings = document.querySelectorAll(".listing:not(.done-" + name + ")"); // get all listings that don't have been processed yet;
214+
function ForEachListing(name, done) {
215+
PageLoad(function() {
216+
var listings = document.querySelectorAll(".listing:not(.done-" + name + ")"); // get all listings that don't have been processed yet;
207217
Array.forEach(listings, (listing) => {
208-
listing.classList.add("done-" + name); // mark element as done;
218+
listing.classList.add("done-" + name); // mark element as done;
209219
done(listing);
210220
});
211221
});

0 commit comments

Comments
 (0)