|
16 | 16 | // @include *horizon.tv* |
17 | 17 | // ==/UserScript== |
18 | 18 |
|
19 | | -(function HorizonTVFixer(){ |
| 19 | +(function HorizonTVFixer() { |
20 | 20 |
|
21 | | - if(!unsafeWindow.BBVSettingsObject){ return; } // ignore iframes; |
| 21 | + // ignore iframes; |
| 22 | + if (!unsafeWindow.BBVSettingsObject) { |
| 23 | + return; |
| 24 | + } |
22 | 25 |
|
23 | 26 | console.log("Version: " + unsafeWindow.BBVSettingsObject.version.major + "." + unsafeWindow.BBVSettingsObject.version.minor + "." + unsafeWindow.BBVSettingsObject.version.micro); |
24 | 27 |
|
25 | 28 | /* Social share & Program/Film info; */ |
26 | 29 | var url = location.href, |
27 | 30 | socials = { |
28 | 31 | Google: { |
29 | | - submit: function(title, subtitle, channel, time){ |
| 32 | + submit: function(title, subtitle, channel, time) { |
30 | 33 | return "https://www.google.nl/search?q=" + encodeURIComponent(title + (subtitle ? ", " + subtitle : "")); |
31 | 34 | }, |
32 | 35 | icon: "https://www.google.nl/favicon.ico" |
33 | 36 | }, |
34 | 37 | IMDb: { |
35 | | - submit: function(title, subtitle, channel, time){ |
| 38 | + submit: function(title, subtitle, channel, time) { |
36 | 39 | return "http://www.imdb.com/find?q=" + encodeURIComponent((title + (subtitle ? " - " + subtitle : "")).trim()); |
37 | 40 | }, |
38 | 41 | icon: "https://secure.imdb.com/images/SFff39adb4d259f3c3fd166853a6714a32/legacy/favicon.ico" |
39 | 42 | }, |
40 | 43 | YouTube: { |
41 | | - submit: function(title, subtitle, channel, time){ |
| 44 | + submit: function(title, subtitle, channel, time) { |
42 | 45 | return "https://youtube.com/results?search_query=" + encodeURIComponent((title + (subtitle ? " - " + subtitle : "")).trim()); |
43 | 46 | }, |
44 | 47 | icon: "https://youtube.com/favicon.ico" |
45 | 48 | }, |
46 | 49 | Twitter: { |
47 | | - submit: function(title, subtitle, channel, time){ |
| 50 | + submit: function(title, subtitle, channel, time) { |
48 | 51 | 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 + " -"); |
51 | 54 | }, |
52 | 55 | icon: "https://twitter.com/favicon.ico" |
53 | 56 | }, |
54 | 57 | "Uitzending Gemist": { |
55 | | - submit: function(title, subtitle, channel, time){ |
| 58 | + submit: function(title, subtitle, channel, time) { |
56 | 59 | return "http://www.uitzendinggemist.nl/zoek?q=" + encodeURIComponent((title + (subtitle ? " - " + subtitle : "")).trim()); |
57 | 60 | }, |
58 | 61 | icon: "https://mijn.npo.nl/favicon.ico" |
59 | 62 | }, |
60 | 63 | KijkWijzer: { |
61 | | - submit: function(title, subtitle, channel, time){ |
| 64 | + submit: function(title, subtitle, channel, time) { |
62 | 65 | return "http://www.kijkwijzer.nl/index.php?id=3__i&searchfor=" + encodeURIComponent((title + (subtitle ? " - " + subtitle : "")).trim()); |
63 | 66 | }, |
64 | 67 | icon: "http://www.kijkwijzer.nl/favicon.ico" |
65 | 68 | }, |
66 | 69 | IPTorrents: { |
67 | | - submit: function(title, subtitle, channel, time){ |
| 70 | + submit: function(title, subtitle, channel, time) { |
68 | 71 | return "https://iptorrents.com/torrents?q=" + encodeURIComponent(title.trim()); |
69 | 72 | }, |
70 | 73 | icon: "https://iptorrents.com/favicon.ico" |
71 | 74 | } |
72 | 75 | }; |
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; |
76 | 79 |
|
77 | 80 | var $listing = unsafeWindow.$('.listing[data-listing-id="' + imi + '"]'), |
78 | 81 | $channel = $listing.closest('.channel-listing'), |
79 | 82 | station = $channel.get(0), |
80 | 83 | 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; |
82 | 85 | wrap.classList.add("done-social"); |
83 | 86 | var details = wrap.querySelector(".details"), |
84 | 87 | title = details.querySelector("h3").textContent, |
85 | | - subtitle = (details.querySelector("h4") || { textContent: "" }).textContent, |
| 88 | + subtitle = (details.querySelector("h4") || { |
| 89 | + textContent: "" |
| 90 | + }).textContent, |
86 | 91 | channel = details.querySelector(".channel-details").textContent.split(", "); |
87 | 92 | var messageDiv = document.createElement("div"); |
88 | 93 | messageDiv.style.marginTop = "12px"; |
89 | 94 | details.appendChild(messageDiv); |
90 | | - for(var key in socials){ |
| 95 | + for (var key in socials) { |
91 | 96 | var social = socials[key], |
92 | 97 | socialA = document.createElement("a"), |
93 | 98 | socialImg = document.createElement("img"), |
|
119 | 124 |
|
120 | 125 | /* Style fixes; */ |
121 | 126 | addStyle( |
122 | | - /* removed white header; */ "\ |
| 127 | + /* removed white header; */ |
| 128 | + "\ |
123 | 129 | .servicenav.service { \ |
124 | 130 | display: none; \ |
125 | | - } "+ |
| 131 | + } " + |
126 | 132 |
|
127 | | - /* cropped header; */ "\ |
| 133 | + /* cropped header; */ |
| 134 | + "\ |
128 | 135 | .header-options { \ |
129 | 136 | margin-top: 0px !important; \ |
130 | 137 | } \ |
|
149 | 156 | } \ |
150 | 157 | .channel-guide .gids-panel .current-time:before { \ |
151 | 158 | top: -42px; \ |
152 | | - } "+ |
| 159 | + } " + |
153 | 160 |
|
154 | | - /* lower listings; */ "\ |
| 161 | + /* lower listings; */ |
| 162 | + "\ |
155 | 163 | .channel-listing .listings, \ |
156 | 164 | .channel-listing .listings .listing, \ |
157 | 165 | .channel-listing .listings .listing.active, \ |
|
171 | 179 | .network .logo-active-image { \ |
172 | 180 | max-height: 29px; \ |
173 | 181 | transform: inherit; \ |
174 | | - } "+ |
| 182 | + } " + |
175 | 183 |
|
176 | | - /* smaller font size in listing; */ "\ |
| 184 | + /* smaller font size in listing; */ |
| 185 | + "\ |
177 | 186 | .channel-listing .listings .listing .title { \ |
178 | 187 | font-size: 12px; \ |
179 | | - } "+ |
| 188 | + } " + |
180 | 189 |
|
181 | | - /* hide bottom bar; */ "\ |
| 190 | + /* hide bottom bar; */ |
| 191 | + "\ |
182 | 192 | .MyOrionBar { \ |
183 | 193 | display: none; \ |
184 | | - } "+ |
185 | | - ""); |
| 194 | + } " + |
| 195 | + ""); |
186 | 196 |
|
187 | | - function addStyle(css){ |
| 197 | + function addStyle(css) { |
188 | 198 | var heads = document.getElementsByTagName("head"); |
189 | 199 | if (heads.length > 0) { |
190 | 200 | var node = document.createElement("style"); |
|
194 | 204 | } |
195 | 205 | } |
196 | 206 |
|
197 | | - function PageLoad(done){ |
198 | | - if(unsafeWindow.$){ |
| 207 | + function PageLoad(done) { |
| 208 | + if (unsafeWindow.$) { |
199 | 209 | //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; |
201 | 211 | } |
202 | 212 | } |
203 | 213 |
|
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; |
207 | 217 | Array.forEach(listings, (listing) => { |
208 | | - listing.classList.add("done-" + name); // mark element as done; |
| 218 | + listing.classList.add("done-" + name); // mark element as done; |
209 | 219 | done(listing); |
210 | 220 | }); |
211 | 221 | }); |
|
0 commit comments