MCPcopy Create free account
hub / github.com/MALSync/MALSync / streamingUI

Method streamingUI

src/kitsu/kitsuClass.ts:192–243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190 }
191
192 async streamingUI() {
193 con.log('Streaming UI');
194 $('#mal-sync-stream-div').remove();
195 const { malObj } = this.page;
196
197 const streamUrl = malObj.getStreamingUrl();
198 if (streamUrl) {
199 $(document).ready(async function () {
200 $('.media--title h3')
201 .first()
202 .after(
203 j.html(`
204 <div class="data title progress" id="mal-sync-stream-div" style="display: inline-block; position: relative; top: -4px; display: inline;">
205 <a class="mal-sync-stream" title="${
206 streamUrl.split('/')[2]
207 }" target="_blank" style="margin: 0 0;" href="${streamUrl}">
208 <img src="${utils.favicon(streamUrl.split('/')[2])}">
209 </a>
210 </div>`),
211 );
212
213 const resumeUrlObj = malObj.getResumeWatching();
214 const continueUrlObj = malObj.getContinueWatching();
215 con.log('Resume', resumeUrlObj, 'Continue', continueUrlObj);
216 if (continueUrlObj && continueUrlObj.ep === malObj.getEpisode() + 1) {
217 $('#mal-sync-stream-div').append(
218 j.html(
219 `<a class="nextStream" title="${api.storage.lang(
220 `overview_Continue_${malObj.getType()}`,
221 )}" target="_blank" style="margin: 0 5px 0 0; color: #BABABA;" href="${
222 continueUrlObj.url
223 }">
224 <img src="${api.storage.assetUrl('double-arrow-16px.png')}" width="16" height="16">
225 </a>`,
226 ),
227 );
228 } else if (resumeUrlObj && resumeUrlObj.ep === malObj.getEpisode()) {
229 $('#mal-sync-stream-div').append(
230 j.html(
231 `<a class="resumeStream" title="${api.storage.lang(
232 `overview_Resume_Episode_${malObj.getType()}`,
233 )}" target="_blank" style="margin: 0 5px 0 0; color: #BABABA;" href="${
234 resumeUrlObj.url
235 }">
236 <img src="${api.storage.assetUrl('arrow-16px.png')}" width="16" height="16">
237 </a>`,
238 ),
239 );
240 }
241 });
242 }
243 }
244
245 getImage() {
246 return j.$('.media-poster img').attr('src') || '';

Callers 1

initMethod · 0.95

Calls 4

removeMethod · 0.80
langMethod · 0.80
assetUrlMethod · 0.80
getStreamingUrlMethod · 0.45

Tested by

no test coverage detected