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

Method bookmarks

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

Source from the content-addressed store, hash-verified

333 private tempMangalist: any = null;
334
335 bookmarks() {
336 if (this.authError) return;
337 const This = this;
338 $(document).ready(() => {
339 if (this.page!.type === 'anime') {
340 if (this.tempAnimelist !== null) {
341 fullListCallback(this.tempAnimelist);
342 return;
343 }
344 } else if (this.tempMangalist !== null) {
345 fullListCallback(this.tempMangalist);
346 return;
347 }
348
349 const listProvider: UserList = new UserList(1, this.page.type);
350
351 listProvider
352 .getCompleteList()
353 .then(list => {
354 if (this.page!.type === 'anime') {
355 this.tempAnimelist = list;
356 } else {
357 this.tempMangalist = list;
358 }
359 fullListCallback(list);
360 })
361 .catch(e => {
362 if (e instanceof NotAutenticatedError) this.authError = true;
363 con.error(e);
364 listProvider.flashmError(e);
365 });
366
367 function fullListCallback(list) {
368 let cover = true;
369 if ($('.library-list tbody tr').length) cover = false;
370 con.log(list);
371 $.each(list, async (index, en: listElement & { kitsuSlug: string }) => {
372 con.log('en', en);
373 if (typeof en.malId !== 'undefined' && en.malId !== null && en.malId) {
374 const element = $(
375 `.library-grid-popover:not(.malSyncDone2) a[href^="/${This.page!.type}/${
376 en.kitsuSlug
377 }"], .library-list tbody tr:not(.malSyncDone2) a[href^="/${This.page!.type}/${
378 en.kitsuSlug
379 }"]`,
380 )
381 .first()
382 .parent()
383 .parent()
384 .parent();
385 con.log(element);
386 element.addClass('malSyncDone2');
387
388 if (en.options && en.options.u) {
389 con.log(en.options.u);
390
391 if (cover) {
392 element.prepend(

Callers 1

initMethod · 0.95

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected