userscripts/viewcomic.scraper.user.js

40 lines
1,008 B
JavaScript
Raw Normal View History

2018-01-19 13:02:27 -06:00
// -*- tab-width: 4; js-indent-level: 4; -*-
// ==UserScript==
// @name Viewcomic Scraper
// @namespace danielrayjones
2018-04-16 10:54:59 -05:00
// @version 0.0.2
2018-01-19 13:02:27 -06:00
// @description Scrape comics from viewcomic.com
// @author Dan Jones
// @match http://viewcomic.com/*
// @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @require https://raw.githubusercontent.com/tommcfarlin/konami-code/master/src/jquery.konami.min.js
// ==/UserScript==
(function() {
'use strict';
$(window).konami({
code: [71,69,84],
eventName: 'konami.get'
});
$(window).on('konami.get', getStuff);
function getStuff() {
let i = 0;
2018-04-16 10:54:59 -05:00
$('div.pinbin-copy img.picture').each(function () {
2018-01-19 13:02:27 -06:00
let $el = $('<a>');
$(document.body).append($el);
$el.attr('href', this.src);
$el.attr('download', (i < 10 ? '00' : '0' ) + i + '.jpg');
$el.get(0).click();
i = i+1;
});
}
})();