[Release] ComicVine Userscript

Information and Tutorials on features in Mylar and how to use it
erolosty
Posts: 1
Joined: Sun May 25, 2014 6:42 pm

[Release] ComicVine Userscript

Post by erolosty »

I've written a userscript which adds a mylar button to Comic Vine pages

You can paste the code into the Chrome extension TamperMonkey

It assumes your Mylar url is: http://localhost:8090 - if not please replace in the source.

Would be awesome if EvilHero added this to Mylar the same way CouchPotato lets you install userscript.

Regards,
Losty

Image

Code: Select all

// ==UserScript==
// @name        Comic Vine Mylar
// @namespace   http://www.comicvine.com/
// @author		Losty
// @include     http://www.comicvine.com/*
// @version     1
// ==/UserScript==
if ($($(".wiki-page-type")[0]).text().indexOf("Volume") != -1){
	current = $($(".instapaper_title")[0]).html()
	$($(".instapaper_title")[0]).html("<a href='http://localhost:8090/addComic?comicid="+document.URL.split("/")[4].split("-")[1]+"'><img style='width:50px' alt='Download with Mylar' title='Download with Mylar' src='https://raw.githubusercontent.com/evilhero/mylar/master/data/images/mylarlogo.png'/></a>"+current)
}
User avatar
evilhero
Site Admin
Posts: 2894
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: [Release] ComicVine Userscript

Post by evilhero »

heh, I was just thinking a few days ago that this would be something cool to have so that you can add it directly in ;)

So sweet, I'll definitely figure out away to add this into the repo somehow kinda like the way CP does it..I just need to figure out how to do it .

Thanks for the code and the work!
Offspring
Posts: 271
Joined: Fri Jan 02, 2015 3:26 am

Re: [Release] ComicVine Userscript

Post by Offspring »

I just tried using this script, but it wasn't working. Did something change on the Chrome/Tampermonkey side that broke it?
User avatar
evilhero
Site Admin
Posts: 2894
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: [Release] ComicVine Userscript

Post by evilhero »

I believe something changed on the ComicVine site itself so now the Userscript can't detect the page properly, and thereby place the Mylar logo on the screen. I briefly looked at it yesterday, but Userscripts aren't something I've used or tinkered with before.

If someone else can figure it out, it would save me the time in trying to figure things out (since I didn't create the script).
Yager
Posts: 15
Joined: Fri Dec 26, 2014 4:06 pm

Re: [Release] ComicVine Userscript

Post by Yager »

I tried the script today and it seemed not to work. After i changed the execution order so this script gets executed first it works fine on my end.

Also would it be possible when you click the button you get a message that it is being added or something and not go to your mylar installation? That way you can add more comics faster.
User avatar
evilhero
Site Admin
Posts: 2894
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: [Release] ComicVine Userscript

Post by evilhero »

I didn't even notice that I was using some other script - reloaded this one and it's working just fine. Although, at one point I did have to add one line to the UserScript delaration section :

Code: Select all

// @grant none
I kept on getting a message saying that it had an invalid grant header (had a Warning icon in the tampermonkey dashboard). Adding that line let it go through and things started working again.

Also would it be possible when you click the button you get a message that it is being added or something and not go to your mylar installation? That way you can add more comics faster.
If anyone knows of a way to have the submit go through, but not update the current page (meaning don't browse away from it) - please let me know. It's possible now to replace the 'addComic?' function with the 'addbyid?' function, and have Mylar return to the previous command in the url call which would mean it wouldn't browse away from the page. I can't seem to figure the call out by doing the ajax method, so hopefully there's someone out there with the knowledge and foresight to do this (where's erolosty eh!)
Offspring
Posts: 271
Joined: Fri Jan 02, 2015 3:26 am

Re: [Release] ComicVine Userscript

Post by Offspring »

Problem was that I was running TamperMonkey, not TamperMonkey BETA. By installing the beta version, the script started working.
cojoMan
Posts: 28
Joined: Sun Jan 18, 2015 7:56 am

Re: [Release] ComicVine Userscript

Post by cojoMan »

is this still working for anyone ?...
Mylar Version: development -- git build 09f6e32d603a818f3cba9d4f6161049457602eb0
Windows 10 x64, SabNZBd
User avatar
evilhero
Site Admin
Posts: 2894
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: [Release] ComicVine Userscript

Post by evilhero »

cojoMan wrote:is this still working for anyone ?...
You probably want to use this one instead of the original (updated to include the new CV url + changed the function that is called as it's cleaner)
Also, if you run Mylar on a separate machine, or plan on browsing CV to add from a different machine, make sure to change the 'localhost' to whatever IP mylar is running on.

Code: Select all

// ==UserScript==
// @name        Comic Vine Mylar
// @namespace   http://comicvine.gamespot.com/
// @author      Losty
// @include     http://comicvine.gamespot.com/*
// @version     1
// ==/UserScript==
if ($($(".wiki-page-type")[0]).text().indexOf("Volume") != -1){
   current = $($(".instapaper_title")[0]).html();
   $($(".instapaper_title")[0]).html("<a href='http://localhost:8090/addbyid?comicid="+document.URL.split("/")[4].split("-")[1]+"' target='_blank'><img style='width:50px' alt='Download with Mylar' title='Download with Mylar' src='https://raw.githubusercontent.com/evilhero/mylar/master/data/images/mylarlogo.png'/></a>"+current);
}
This is working with the non-beta version of Tampermonkey and in Chrome Canary.

Make sure you install the Tampermonkey extension, not the Tampermonkey app (Tampermonkey doesn't have an app - it's a bogus app)

All made possible by Losty ;)
cojoMan
Posts: 28
Joined: Sun Jan 18, 2015 7:56 am

Re: [Release] ComicVine Userscript

Post by cojoMan »

thanks evilhero , thanks Lotsy
it's alive !! :)
Mylar Version: development -- git build 09f6e32d603a818f3cba9d4f6161049457602eb0
Windows 10 x64, SabNZBd
Post Reply