Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mangaupdates.com updated, script doesnt work anymore #17

Open
byleco1234 opened this Issue Feb 23, 2019 · 13 comments

Comments

Projects
None yet
6 participants
@byleco1234
Copy link

byleco1234 commented Feb 23, 2019

There was a site update today (23rd of February) and script stopped working, cant see group websites anymore https://www.mangaupdates.com/news.html?id=119804

@Geese1

This comment has been minimized.

Copy link

Geese1 commented Feb 23, 2019

Same here. Neither this, nor the Cover Preview scripts are now working after the site redesign. Really loved both, and if there's any way to get them functioning again that would be great.

@Vilacard

This comment has been minimized.

Copy link

Vilacard commented Feb 24, 2019

Nothing to add other than to say it also no longer works for me.

@byleco1234

This comment has been minimized.

Copy link
Author

byleco1234 commented Feb 24, 2019

Same here. Neither this, nor the Cover Preview scripts are now working after the site redesign. Really loved both, and if there's any way to get them functioning again that would be great.

Cover preview (at least the one i use) has been updated and it works now
https://greasyfork.org/en/scripts/26513-mangaupdates-cover-preview

@anon-programmer

This comment has been minimized.

Copy link

anon-programmer commented Feb 28, 2019

I figured out the issue, it has to do with resolving IRC link. Fixing that will get the website link to work again, but with the changes to MU's UI, the "Site" portion will be placed at the bottom and I'm not familiar enough with JS to fix the UI.

edit (28-02-2019): Forgot to mention I tested this fix against Chromium with Tampermonkey. I'll check out the "fix" against FF and Greasemonkey/Violent monkey/Tampermonkey. If I have free time I'll look at this further when I have more free time to fix the UI side of things too.

function fix_irc() {
  var list = document.getElementsByClassName("text");
  var irc='';

  for (var i=0; i<list.length; i++){
      if(list[i].innerHTML == "<u>IRC</u>") {
          list[i].id = "fixed_irc_url";
          if((irc=list[i].nextElementSibling.innerText) != "<i>No IRC</i>") {
              var a = irc.replace(/^.+@/,'');
              var b = irc.replace('#','').replace(/@.*/,'');
              list[++i].innerHTML='<a href="irc://'+a+'/'+b+'"><u>'+a+'/'+b+'</u></a>';
          }
        break;
      }
  }
}
@Vilacard

This comment has been minimized.

Copy link

Vilacard commented Feb 28, 2019

That seems to work for now. Thanks!

@Geese1

This comment has been minimized.

Copy link

Geese1 commented Feb 28, 2019

I figured out the issue, it has to do with resolving IRC link. Fixing that will get the website link to work again, but with the changes to MU's UI, the "Site" portion will be placed at the bottom and I'm not familiar enough with JS to fix the UI.

function fix_irc() {
  var list = document.getElementsByClassName("text");
  var irc='';

  for (var i=0; i<list.length; i++){
      if(list[i].innerHTML == "<u>IRC</u>") {
          list[i].id = "fixed_irc_url";
          if((irc=list[i].nextElementSibling.innerText) != "<i>No IRC</i>") {
              var a = irc.replace(/^.+@/,'');
              var b = irc.replace('#','').replace(/@.*/,'');
              list[++i].innerHTML='<a href="irc://'+a+'/'+b+'"><u>'+a+'/'+b+'</u></a>';
          }
        break;
      }
  }
}

Thanks for the update! Was easy enough to add it manually, and now it works like it should. It's not pretty (it looks weird when there's no IRC link to use!), but the functionality is there, and that's what matters.

Really appreciate you taking the time to work on this!

@Hyacia

This comment has been minimized.

Copy link

Hyacia commented Mar 1, 2019

I figured out the issue, it has to do with resolving IRC link. Fixing that will get the website link to work again, but with the changes to MU's UI, the "Site" portion will be placed at the bottom and I'm not familiar enough with JS to fix the UI.

edit (28-02-2019): Forgot to mention I tested this fix against Chromium with Tampermonkey. I'll check out the "fix" against FF and Greasemonkey/Violent monkey/Tampermonkey. If I have free time I'll look at this further when I have more free time to fix the UI side of things too.

function fix_irc() {
  var list = document.getElementsByClassName("text");
  var irc='';

  for (var i=0; i<list.length; i++){
      if(list[i].innerHTML == "<u>IRC</u>") {
          list[i].id = "fixed_irc_url";
          if((irc=list[i].nextElementSibling.innerText) != "<i>No IRC</i>") {
              var a = irc.replace(/^.+@/,'');
              var b = irc.replace('#','').replace(/@.*/,'');
              list[++i].innerHTML='<a href="irc://'+a+'/'+b+'"><u>'+a+'/'+b+'</u></a>';
          }
        break;
      }
  }
}

Nice work. I fixed the formatting (using Greasemonkey on FireFox, so I can confirm your fix works on FF). I never used this script before, so I'm not sure exactly how you'd want it to behave, but the link fixing works. I put the site and site link elements somewhere that made sense to me (under IRC info).

Not exactly elegant, but I'm not overly familiar with JS. I had to split up the "Site" + suggestion box link and actual URL to preserve the (div tag...) "table" format on MU. I couldn't find a way around this due to the way the DOM works. The createElement function automatically appends the closing tag, but also prevents you from closing it within the innerHTML element as you might want to. The resulting div block messed up the table layout.

Relevant changes (last 7 lines in original):

    var urlfix_site_fixed = document.getElementById('fixed_group_suggestion');
    var urlfix_site = urlfix_site_fixed || document.createElement('div');
urlfix_site.setAttribute("class", "p-1 col-6 text");
    urlfix_site.id = "fixed_group_suggestion";
    urlfix_site.innerHTML = '<u>Site</u><a href="#" onclick="urlfix_openSuggBox();"> (Suggest an update)</a>';
  	var urlfix_site_par = document.querySelector('div.general_table:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(5)');
    urlfix_site_par.parentNode.insertBefore(urlfix_site, urlfix_site_par);
  	if(!urlfix_site_fixed) {
        var urlfix_irc_par = document.getElementById("fixed_irc_url").parentNode;
        urlfix_irc_par.parentNode.insertAfter(urlfix_site, urlfix_irc_par.nextSibling);
    }
  	var site_link_fixed = document.getElementById('fixed_site_link');
  	var site_link = site_link_fixed || document.createElement('div');
  	site_link.setAttribute("class", "p-1 col-6 text");
  	site_link.id = "fixed_site_link";
  	site_link.innerHTML = (urlfix_groupSite === undefined ? '<i>No Info</i>' : ('<a target="_blank" alt="" href="' + urlfix_groupSite + '"><u>' + urlfix_groupSite + '</u></a>'));
  	var site_link_par = document.querySelector('#fixed_group_suggestion');
    site_link_par.parentNode.insertBefore(site_link, urlfix_site);
  	if(!site_link_fixed) {
      	var site_link_par = document.getElementById("fixed_site_link");
      	site_link_par.parentNode.insertBefore(site_link, urlfix_site_par.nextSibling);
    }

Full code: https://pastebin.com/qRKCaUyB

@anon-programmer

This comment has been minimized.

Copy link

anon-programmer commented Mar 1, 2019

Nice work. I fixed the formatting (using Greasemonkey on FireFox, so I can confirm your fix works on FF). I never used this script before, so I'm not sure exactly how you'd want it to behave, but the link fixing works. I put the site and site link elements somewhere that made sense to me (under IRC info). Relevant changes (last 7 lines in original):

Full code: https://pastebin.com/qRKCaUyB

Very nice! Thanks for working on the UI portion, I had so much difficulties getting that to append to the UI element of MU design it was so confusing to me.
I checked it on chromium and it's working fine for me too.

anon-programmer pushed a commit to anon-programmer/mangaupdates-urlfix that referenced this issue Mar 1, 2019

@Geese1

This comment has been minimized.

Copy link

Geese1 commented Mar 1, 2019

Thanks for the UI fix, Hyacia! I use Tampermonkey in Chrome and it works fine there. The only issue I'm still seeing is that if there's no IRC channel, the script still pastes: "NoIRC/NoIRC" as a hyperlink. Ideally, it should just be regular wording that reads: "No IRC" in the same italicized font as when there's no Facebook or Twitter for example.

Other than that, great work! So glad the community is coming together to resolve this issue!

@Hyacia

This comment has been minimized.

Copy link

Hyacia commented Mar 1, 2019

Thanks for the UI fix, Hyacia! I use Tampermonkey in Chrome and it works fine there. The only issue I'm still seeing is that if there's no IRC channel, the script still pastes: "NoIRC/NoIRC" as a hyperlink. Ideally, it should just be regular wording that reads: "No IRC" in the same italicized font as when there's no Facebook or Twitter for example.

Other than that, great work! So glad the community is coming together to resolve this issue!

That didn't bother me at the time, but it does now that you've mentioned it. The issue was literally just 4 letters (the last 4 in the element reference). Change innerText to innerHTML in line 54 and it works as you described.

if((irc=list[i].nextElementSibling.innerHTML) != "<i>No IRC</i>") {

@anon-programmer Might want to update to include this

@anon-programmer

This comment has been minimized.

Copy link

anon-programmer commented Mar 1, 2019

Thanks Geese1 andHyacia, I have changed that in the IRC link function.

@Geese1

This comment has been minimized.

Copy link

Geese1 commented Mar 1, 2019

That didn't bother me at the time, but it does now that you've mentioned it. The issue was literally just 4 letters (the last 4 in the element reference). Change innerText to innerHTML in line 54 and it works as you described.

if((irc=list[i].nextElementSibling.innerHTML) != "<i>No IRC</i>") {

@anon-programmer Might want to update to include this

Thanks, works like a charm!

@loadletter

This comment has been minimized.

Copy link
Owner

loadletter commented Mar 10, 2019

Sorry, I was busy, I will look into updating this

loadletter added a commit that referenced this issue Mar 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.