cuzi Moderator

I am gonna work on this in the next few days 😊
I think I am going to do a "mark as played" button that (ideally) will work everywhere on bandcamp.com on every album cover/album link and also highlight the played albums everywhere as well.

Regarding the downloading, I have a script that offers download links for individual songs. I don't like to go further, I don't think it's fair to offer whole albums or even several albums for download with a single click. From a programming standpoint it doesn't make much sense to include it either, such a script would additionally need: downloading mp3 files, zipping the mp3 files together and offering a download option.

Regarding 4) Did you mean these "The time has come to open thy wallet" popups? You can just close them, so yeah, a script could do that as well. Or is there another limit that actually stops you from playing the song?


I think 1),2) would definitely be a nice thing. I am gonna investigate how difficult it is, but I believe it should be easy to implement.

  1. Is this already implemented by a userscript for album pages? If so, could you post a link to that script.

4),5) Possible, but I don't like it :)


Update:

// ==UserScript==
// @name        eBay - Hilight Items With Bids
// @namespace   http://userscripts.org/users/126140
// @include     https://*.ebay.*/*
// @include     http://*.ebay.*/*
// @grant       unsafeWindow
// @version     2.2.1
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @description Hilights items that have bids with a red border and yellow background.
// ==/UserScript==

(function() {

  var highlightBids = function() {

    $(".sresult").each(function() {
      var li = $(this);
      var text = li.text(); 
      var regExp = /([0-9]+)\s+(b|B)ids?/;
      if (regExp.test(text)) {
        var match = regExp.exec(text);
        var numBids = parseInt(match[1], 10);
        if(numBids > 0) {
          li.css({"border":"3px solid red","background-color":"yellow"}); // Regular listing of articles
          li.closest('li.li').css({"border":"3px solid red","background-color":"yellow"});  // Some search results are not shown in the above "regular" way
          li.closest('div.box.mitem').css({"border":"3px solid red","background-color":"yellow"}); // Tiled search results
        }
      }
    });
  }

  var window_history_pushState = window.history.pushState;
  window.history.pushState = function () {
    window_history_pushState.apply(window.history, arguments);
    window.setTimeout(highlightBids, 0);
  }

  $(window).bind('popstate', function() {
    window.setTimeout(highlightBids, 1000);
  });

  highlightBids();

})();

Updated:

// ==UserScript==
// @name        eBay - Hilight Items With Bids
// @namespace   http://userscripts.org/users/126140
// @include     https://*.ebay.*/*
// @include     http://*.ebay.*/*
// @grant       unsafeWindow
// @version     2.2.1
// @require     http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @description Hilights items that have bids with a red border and yellow background.
// ==/UserScript==

(function() {
  
  var highlightBids = function() {
    
    $(".s-item").each(function() {
      var li = $(this);
      var text = li.text(); 
      var regExp = /([0-9]+)\s+(b|B)ids?/;
      if (regExp.test(text)) {
        var match = regExp.exec(text);
        var numBids = parseInt(match[1], 10);
        if(numBids > 0) {
          li.css({"border":"3px solid red","background-color":"yellow"}); // Regular listing of articles
          li.closest('li.li').css({"border":"3px solid red","background-color":"yellow"});  // Some search results are not shown in the above "regular" way
          li.closest('div.box.mitem').css({"border":"3px solid red","background-color":"yellow"}); // Tiled search results
        }
      }
    });
  }
  
  var window_history_pushState = window.history.pushState;
  window.history.pushState = function () {
    window_history_pushState.apply(window.history, arguments);
    window.setTimeout(highlightBids, 0);
  }
  
  $(window).bind('popstate', function() {
    window.setTimeout(highlightBids, 1000);
  });
  
  highlightBids();
  
})();

It seems to work in Firefox with Greasemonkey for me.
Here's the code I am using:

// ==UserScript==
// @name 				eBay - Hilight Items With Bids
// @namespace 	http://userscripts.org/users/126140
// @include 		https://*.ebay.*/*
// @include 		http://*.ebay.*/*
// @grant       unsafeWindow
// @version     2.2.1
// @require 		http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @description Hilights items that have bids with a red border and yellow background.
// ==/UserScript==

(function() {
  
  var highlightBids = function() {
    
    $(".lvformat").each(function() {
      $this = $(this);
      var text = $this.text();
      var regExp = /([0-9]+)\s+(b|B)ids?/;
      if (regExp.test(text)) {
        var match = regExp.exec(text);
        var numBids = parseInt(match[1], 10);
        if(numBids > 0) {
          $this.closest('li.con-rst').css({"border":"3px solid red","background-color":"yellow"}); // Regular listing of articles
          $this.closest('li.li').css({"border":"3px solid red","background-color":"yellow"});  // Some search results are not shown in the above "regular" way
          $this.closest('div.box.mitem').css({"border":"3px solid red","background-color":"yellow"}); // Tiled search results
        }
      }
    });
  }
  
  var window_history_pushState = window.history.pushState;
  window.history.pushState = function () {
    window_history_pushState.apply(window.history, arguments);
    window.setTimeout(highlightBids, 0);
  }
  
  $(window).bind('popstate', function() {
    window.setTimeout(highlightBids, 1000);
  });
  
  highlightBids();
  
})();

The image is not loaded because last.fm uses a new web feature called "Content Security Policy". This basically means that you cannot include images (or any other content) from third-party sites on last.fm. I don't see a (simple) solution to avoid that, so for now I leave it that way.

I cannot reproduce the second problem, but I am guessing it has something to do with last.fm being slow. I'm going to look into how to solve this properly.
In the mean time, you could try to change the following line in the source code (at the end of the script): window.setTimeout(main,1000);
The 1000 stands for 1000 milliseconds = 1 second. It means if you click on a link, the script shows the window after 1 second, regardless of whether the new last.fm page is loaded or if the old page is still there. If you put 2000 or 3000, it should give enough time to load the new page and the window should then be hidden.


I don't really use these music sites, so it's always good if someone reports :)

Yeah looks like pitchfork and last.fm both had some pretty big design changes on their websites.
It should work again. I also fixed steam, gamespot, tv.com and consequenceofsound.net


I added it, but I didn't test it much.
So if it doesn't work well, please report back.


Re: @riccardo:
I just updated the script, but I only added alfafile.net!
Adding other sites is no big deal. It currently just suits my personal needs.

If you'd like me to add a website, please send me a working download link or a website where these links are posted (email: cuzi[at]openmail.cc)


Re: @Computerexpert:
Try this, it seemed to work but I didn't have time to test it thoroughly:

(function() {
  
  var highlightBids = function() {
    
    $(".lvformat").each(function() {
      $this = $(this);
      var text = $this.text();
      var regExp = /([0-9]+)\s+(b|B)ids?/;
      if (regExp.test(text)) {
        var match = regExp.exec(text);
        var numBids = parseInt(match[1], 10);
        if(numBids > 0) {
          $this.closest('li.con-rst').css({"border":"3px solid red","background-color":"yellow"}); // Regular listing of articles
          $this.closest('li.li').css({"border":"3px solid red","background-color":"yellow"});  // Some search results are not shown in the above "regular" way
          $this.closest('div.box.mitem').css({"border":"3px solid red","background-color":"yellow"}); // Tiled search results
        }
      }
    });
  }
  
  var window_history_pushState = window.history.pushState;
  window.history.pushState = function () {
    window_history_pushState.apply(window.history, arguments);
    window.setTimeout(highlightBids, 0);
  }
  
  $(window).bind('popstate', function() {
    window.setTimeout(highlightBids, 1000);
  });
  
  highlightBids();
  
})();

The demo page didn't work for me either, the problem was that I had the Firefox addon Cookie Controller enabled, which blocks cookies and DOM storage. However this might not be relevant, as this addon is not really popular.
This is the error in the console:

  • jMod - jModReady 185.31msj Mod.full.js (line 2937)
  • jMod.Settings Test settings.js (line 4)
  • SecurityError: The operation is insecure. ...rn (localStorage?localStorage:(window.localStorage?window.localStorage:unsafeWin... jMod.full.js (line 4244)
  • jMod - onPageReady 1024.30ms jMod.full.js (line 2937)

The reason for the blackness is a css filter: invert(100%) in line 319. Firefox 35 probably implemented this filter thing.


Re: @Computerexpert:
I am guessing the script uses another jquery version than ebay, which gets injected into the page and breaks the page - but I am not sure.
Anyway, just replace // @grant none with // @grant unsafeWindow.
This forces Greasemonkey to execute the script in a sandbox and prevents it from breaking the page's javascript.


Re: @JixunMoe:
Re: @JixunMoe:
Go on the edit info page and just type the name in the upper right corner and click on the "dropdown effect" to approve it.
Although I think you can only do this once per script.


Re: @Computerexpert:
I see it now, it does not happen in Firefox though...

Tested it with Chrome, it seems to work (most of the time).

function highlightBids() {
  $(".bids").each(function() {
    $this = $(this);
    var text = $this.text();
    var regExp = /([0-9]+)\s+(b|B)ids?/;
    if (regExp.test(text)) {
      var match = regExp.exec(text);
      var numBids = parseInt(match[1], 10);
      if(numBids > 0) {
        $this.closest('li.con-rst').css({"border":"3px solid red","background-color":"yellow"}); // Regular listing of articles
        $this.closest('li.li').css({"border":"3px solid red","background-color":"yellow"});  // Some search results are not shown in the above "regular" way
        $this.closest('div.box.mitem').css({"border":"3px solid red","background-color":"yellow"}); // Tiled search results
      }
    }
  });
}

var window_history_pushState = window.history.pushState;
window.history.pushState = function () {
  window_history_pushState.apply(window.history, arguments);
  window.setTimeout(highlightBids, 0);
}

$(window).bind('popstate' ,function() {
  window.setTimeout(highlightBids, 1000);
});

highlightBids();

Re: @Computerexpert:
Could you post a URL where it happens? I seems to work everywhere I try...

Anyway I found another error: you can change $(".bids span") back to $(".bids")


My initial solution only worked for some search results.
It seems like ebay now has different ways of listing articles. I found three but there might be more.

$('document').ready(function() {
    $(".bids span").each(function() {
        $this = $(this);
        var text = $this.text();
        var regExp = /([0-9]+)\s+(b|B)ids?/;
        if (regExp.test(text)) {
            var match = regExp.exec(text);
            var numBids = parseInt(match[1], 10);
            if(numBids > 0) {
                $this.closest('li.con-rst').css({"border":"3px solid red","background-color":"yellow"}); // Regular listing of articles
                $this.closest('li.li').css({"border":"3px solid red","background-color":"yellow"});  // Some search results are not shown in the above "regular" way
                $this.closest('div.box.mitem').css({"border":"3px solid red","background-color":"yellow"}); // Tiled search results
            }
        }
    });
});```

I successfully tested this with Firefox/Greasemonkey and Chrome/Tampermonkey (latest stable release for all) on ebay.com

Change the two lines starting with $(this).closest(...
Replace them with this:
$(this).closest('li.li').css({"border":"3px solid red","background-color":"yellow"})



Re: @burn:
Thanks it works now!

AFAICT Firefox evaluates new Date.getTime() as new (Date.getTime)()


Re: @burn:
I'm using latest stable Firefox and Greasemonkey.
I think the else-branch will only be reached the first time the script runs.
Uncomment the GM_deleteValue in line 84 to reproduce the error.


In line 102 oldDate = new Date.getTime(); should be oldDate = (new Date).getTime();


Re: @Marti:
Thanks for your reply. Could you explain what you mean by page scope variable or how you would actually do it with unsafeWindow?


I was wondering if there is any way to communicate with another tab or window that runs the same userscript (on the same domain).

window.postMessage() seems to be an option, but I'm not sure if/how it works with tabs that the page did not create.

At the moment I use GM_setValue/GM_getValue and setInterval to regularly check for a changed value. It works but it looks hackish.