Greasy Fork is available in English.

Manga Loader (unmaintained)

Support for over 70 sites! Loads manga chapter into one page in a long strip format, supports switching chapters, minimal script with no dependencies, easy to implement new sites, loads quickly and works on mobile devices through bookmarklet

< Spätná väzba na Manga Loader (unmaintained)

Hodnotenie: Dobré - skript funguje

§
Pridaný: 22.08.2016
Upravený: 22.08.2016

How do i manually add sites to the script?

I've been using you script for a very long time and i'm loving it! Especially when i read manga on Batoto from my Android.

I've been trying to include the website i am currently using to read manga to my script, but i haven't been able to get it to work.
I've tried adding a new line in the existing script and under User settings "Included Pages."
Here are some examples:

https://www.otakusmash.com/read-manga/Lone_Wolf_and_Cub/*/*
www.otakusmash.com/read-manga/Lone_Wolf_and_Cub/*/*
https://www.otakusmash.com/read-manga/*/*/*
www.otakusmash.com/read-manga/*/*/*

Am i going about this the wrong way?

fuzetsuAutor
§
Pridaný: 23.08.2016
Upravený: 23.08.2016

I should probably have a bit more of a tutorial on it somewhere (mental note to work on that), but basically the requirements for implementing a site are the following:

  1. add an @match statement to the top of the script for the site you want
  2. add a new object ({ name: 'name', match: 'regexp', img: '#img', next: '#next' } <-- one of these) to the list of objects, this is the most important part. you can look at the top of the file for a guide for how to structure the object, it can vary from a very simple definition to a fairly complex one based on how weirdly setup the site is.

Once those two steps are done the site should work.

It takes some basic javascript/css knowledge to do it, but using this site as an example this is how you would implement it:

The @match at the top could look like this // @match *://*.otakusmash.com/*/*. Doesn't have to be too specific because the second match in the implementation will take effect next.

The most basic implementation that works could look like this, just defining the match, img and next properties, the img to find the picture on the page, and next to find the link to the next page

{
  name: 'otakusmash',
  match: "https?://www\\.otakusmash\\.com/read-(comics|manga)/.+",
  img: '#omv > table > tbody > tr:nth-child(2) > td.mid > table > tbody > tr:nth-child(3) > td > a > img',
  next: '#omv > table > tbody > tr:nth-child(2) > td.mid > table > tbody > tr:nth-child(3) > td > a'
}

and a complete one with chapter switching, total number of pages and chapter statistics could look like this

{
  name: 'otakusmash',
  match: "https?://www\\.otakusmash\\.com/(read-comics|read-manga)/.+",
  img: 'img.picture',
  next: 'select[name=page] + a',
  curpage: 'select[name=page]',
  numpages: 'select[name=page]',
  nextchap: function(prev) {
    var nextChap = extractInfo('select[name=chapter]', {type: 'value', val: prev ? 1 : -1});
    return nextChap ? location.href.replace(/(read-(comics|manga)\/[^\/]+).*/, '$1/' + nextChap) : null;
  },
  prevchap: function() {
    return this.nextchap(true);
  },
  numchaps: 'select[name=chapter]',
  curchap: 'select[name=chapter]',
  invchap: true
}]

I may at some point try to implement some smarter logic to try and detect how to load the manga, but it would probably be pretty error prone and get fairly complex.

EDIT: updated examples because I forgot about manga portion of the site

fuzetsuAutor
§
Pridaný: 23.08.2016

Pridať odpoveď

Aby ste mohli pridať odpoveď, prihláste sa.