Pass jQuery to IIFE in viewcomic
This commit is contained in:
parent
4a63a7f068
commit
11f4f90ed4
1 changed files with 6 additions and 4 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Viewcomic Scraper
|
// @name Viewcomic Scraper
|
||||||
// @namespace danielrayjones
|
// @namespace danielrayjones
|
||||||
// @version 0.0.5
|
// @version 0.0.6
|
||||||
// @description Scrape comics from viewcomic.com
|
// @description Scrape comics from viewcomic.com
|
||||||
// @author Dan Jones
|
// @author Dan Jones
|
||||||
// @match http://viewcomic.com/*
|
// @match http://viewcomic.com/*
|
||||||
|
|
@ -11,7 +11,9 @@
|
||||||
// @require https://raw.githubusercontent.com/tommcfarlin/konami-code/master/src/jquery.konami.min.js
|
// @require https://raw.githubusercontent.com/tommcfarlin/konami-code/master/src/jquery.konami.min.js
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
(function() {
|
/* global jQuery */
|
||||||
|
|
||||||
|
(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$(window).konami({
|
$(window).konami({
|
||||||
|
|
@ -40,7 +42,7 @@
|
||||||
console.log(img.src);
|
console.log(img.src);
|
||||||
|
|
||||||
fetch(img.src).then(resp => resp.blob()).then(blob => {
|
fetch(img.src).then(resp => resp.blob()).then(blob => {
|
||||||
let $el = jQuery('<a>');
|
let $el = $('<a>');
|
||||||
$(document.body).append($el);
|
$(document.body).append($el);
|
||||||
$el.attr('href', URL.createObjectURL(blob));
|
$el.attr('href', URL.createObjectURL(blob));
|
||||||
$el.attr('download', name + '-' + (i < 10 ? '00' : '0' ) + i + '.jpg');
|
$el.attr('download', name + '-' + (i < 10 ? '00' : '0' ) + i + '.jpg');
|
||||||
|
|
@ -53,4 +55,4 @@
|
||||||
getOne();
|
getOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})(jQuery);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue