Page 4 of 5

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Sat Aug 09, 2014 7:24 pm
by The Binary Son
Got it. Had no idea what greasyfork was. Thanks!

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Sun Aug 10, 2014 6:48 am
by Gingerbread Man
The Binary Son wrote:I originally just wanted to know how to enable ads PER VIDEO not PER CHANNEL, but I'm guessing the former is impossible?
I see no reason for these two issues to be conflated. No one here's interested in whitelisting individual videos, which is possible just with Adblock Plus. They want to whitelist whole channels, which requires a user script.

See how to manually create an appropriate whitelist filter back in your original thread:
forum/viewtopic.php?p=104276#p104276

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Mon Aug 11, 2014 10:12 pm
by The Binary Son
Gingerbread Man wrote:
The Binary Son wrote:I originally just wanted to know how to enable ads PER VIDEO not PER CHANNEL, but I'm guessing the former is impossible?
I see no reason for these two issues to be conflated. No one here's interested in whitelisting individual videos, which is possible just with Adblock Plus. They want to whitelist whole channels, which requires a user script.

See how to manually create an appropriate whitelist filter back in your original thread:
forum/viewtopic.php?p=104276#p104276
Thanks for all of your help! I will try out your suggestions at some point, but at the moment I'm testing out the "per channel" setup I got from this thread.

QUESTION: So I followed the greasyfork directions and everything seems to work fine, BUT I've now noticed that this setup, as is, at least for Firefox, basically nerfs the BACK button, in that, when I press it, it ends up coming back to the current page. (More specifically, if the "normal" video page is PAGE 1 and the "updated" page with the added user info that results from the coding is PAGE 2, when I, while on PAGE 2, press the back button, it goes back to PAGE 1 for a VERY brief moment, but then automatically goes back to PAGE 2.)

So far, I have found 2 work arounds for this:
1. Pressing and holding the back button to bring up the little tab history listing so I can then choose what page I want to go back to.
2. Pressing the back button normally, but then, in the brief window during which I am (using the terms from above) back on PAGE 1, pressing the back button again.

It's nice that there are at least some workarounds for this, and perhaps it might be good to add an FYI at the end of those greasyfork steps about this, but the workarounds are a bit tedious and I miss being able to just press the back button and go back to the previous page.

Anyway, my QUESTION is this: is there anyway to tweak either the coding from greasyfork, or tweak something else, so that the back button functions normally again? I know nothing about coding, but just as an idea, is there a way to remove the "PAGE 1" versions of the video pages from the back button's tab history? Or maybe adjusting the back button to "skip" the PAGE 1 entry and go back to the previous page?

Any thoughts or advice would be greatly appreciated - thanks everyone for your continued help!

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Wed Aug 13, 2014 7:04 am
by Gingerbread Man
The Binary Son wrote:Any thoughts or advice would be greatly appreciated - thanks everyone for your continued help!
One improvement that's easy to make is to rewrite links to YouTube videos. On the search results pages and channel video listings for example, you could avoid the whole page reload rigmarole.
  1. Disable or remove the previous script.
  2. Add this one I cobbled together. I've tested it in Firefox with Greasemonkey and Opera with Violent Monkey and it seems okay. In case of problems, post about them here.
    https://greasyfork.org/scripts/4168-you ... block-plus
  3. Visit the …/user/videos page of the author you want to support (e.g. https://www.youtube.com/user/TotalHalibut/videos) and note the username in the URL. That's what you need to use in your whitelist filter in Adblock Plus. Example:

    Code: Select all

    @@||youtube.com/*&user=TotalHalibut$document
The Binary Son wrote:is there anyway to tweak either the coding from greasyfork, or tweak something else, so that the back button functions normally again?
When it comes to direct links to videos (like those you find on third-party sites), the script will run on every page load, at which point it reloads the page with the &user=<user> bit added to the URL. When you hit the Back button, the original page loads again, the script runs again, and you end up at the &user=<user> page again.

I don't see any way to avoid this nuisance, maybe short of using GM_setValue / GM_getValue to prevent the script from running more than once on any given video page. I don't think that would be desirable — at least I won't bother with it.
The Binary Son wrote:is there a way to remove the "PAGE 1" versions of the video pages from the back button's tab history?
User scripts can't modify browser history, so that's not an option.

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Fri Aug 15, 2014 9:33 pm
by The Binary Son
That seems to have fixed the back issue without affecting the disabling on only certain users' videos. Thanks so much!! I'll post back if I run into any issues!

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Sat Aug 16, 2014 5:57 pm
by The Binary Son
Sorry to bother you, but while your script still works on the disabling for certain channels, the issue with the back button and recycling back to the same page has returned. It's odd because yesterday, at some point I noticed the back button issue was there for certain videos, but not for others, but then as I was trying to figure out if there were any discernible patterns for when it worked and didn't work, the back button issue was now there for every video, including the videos from the channel I added to the filter.

Just now, I removed the script, restarted firefox, re-installed the script, and now the back button issue is simply still there from the beginning. Any help??

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Sun Aug 17, 2014 7:14 am
by Gingerbread Man
I take it you're using Firefox 31.0 and Greasemonkey 2.1. Is this correct?
  1. Press Ctrl+Shift+J to open the browser console, or click the ≡ Menu Button, then the Developer wrench icon, then Browser Console.
  2. In the Filter box, type .user.js
  3. Click the Clear button.
  4. Go to https://www.youtube.com/user/TotalHalibut/videos
  5. Are there any errors listed in the browser console?
  6. Click the dropdown arrow next to the Greasemonkey icon on the toolbar. Do you see a checkmark next to both "Enabled" and "YouTube - whitelist channels in Adblock Plus"?
  7. Right-click the first video and choose Copy Link Location. Paste the link in your reply here.

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Sun Aug 17, 2014 10:29 pm
by The Binary Son
Yes it's FF 31.0 and Greasemonkey 2.1

I went to the console, but when I typed in ".user.js", nothing showed up. Just in case it's helpful, I tried searching in the filter box using the following keywords: "user", "js", "youtube", and "greasemonkey". I then screenshotted what results came up for each - the pics are below:

Screenshot 1Screenshot 2Screenshot 3Screenshot 4

After that, I just cleared everything in the browser console and visited the TotalHalibut link you provided (he isn't one of the channels I'm using your script for, but I did it anyway), and below are screenshots of what came up on the console from visiting that link:

Screenshot 5Screenshot 6Screenshot 7

Then, just in case, I re-cleared the console and went to the same link but for a channel I AM using the script for and entered in the adblock filter, etc., TheSuper360BroScopes, and here are the screenshots of what came up in the console then:

Screenshot 8Screenshot 9Screenshot 10

Next, I went on to youtube and tested out the dropdown arrow of the greasemonkey button. For every page on youtube, the "Enabled" option is checked.

HOWEVER,

Only on non-video youtube pages (like the home pages, the channel pages, the "user/channelname/videos" page, etc.) does the "YouTube - whitelist channels in Adblock Plus" appear, and it is checked. *BUT* for seemingly ANY and EVERY youtube VIDEO PAGE (including ones that are part of an ongoing playlist), the "YouTube - whitelist channels in Adblock Plus" option isn't even there, and instead I see in greyed out text "No installed scripts run on this page."

Finally, regarding your last instruction, I'm assuming by "the first video" you meant the first video on that Halibut videos page? If so, here's the link location:
https://www.youtube.com/watch?v=BMESJvY ... talHalibut

Here's the link location for the same video, but this time I did the whole right clicking thing on the video as it's listed on the channel's main/home page:
https://www.youtube.com/watch?v=BMESJvY ... talHalibut

But again, since I'm not using this script for that channel, I did the same two things for the channel I am using this for as I did for the Halibut channel:

From the "/videos" page:
https://www.youtube.com/watch?v=DyI9DSU ... 0broscopes

From the channel's main page:
https://www.youtube.com/watch?v=DyI9DSU ... 0broscopes



Let me know if there's anything else I can do to help you figure this out - thanks again for your continued help!!!!!

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Mon Aug 18, 2014 7:21 am
by xtreemmasheen3k2
The Binary Son wrote:QUESTION: So I followed the greasyfork directions and everything seems to work fine, BUT I've now noticed that this setup, as is, at least for Firefox, basically nerfs the BACK button, in that, when I press it, it ends up coming back to the current page. (More specifically, if the "normal" video page is PAGE 1 and the "updated" page with the added user info that results from the coding is PAGE 2, when I, while on PAGE 2, press the back button, it goes back to PAGE 1 for a VERY brief moment, but then automatically goes back to PAGE 2.)

So far, I have found 2 work arounds for this:
1. Pressing and holding the back button to bring up the little tab history listing so I can then choose what page I want to go back to.
2. Pressing the back button normally, but then, in the brief window during which I am (using the terms from above) back on PAGE 1, pressing the back button again.

Read full post
What I do is simply Right-Click the Back button. It has the same effect as your workaround #1.

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Mon Aug 18, 2014 8:03 am
by Gingerbread Man
The Binary Son wrote:Let me know if there's anything else I can do to help you figure this out - thanks again for your continued help!!!!!
Please update to version 1.2 of the script. It now rewrites links added by the "Load more" button on the channel listing and channel search pages.

Can you tell me exactly what you're doing, step by step, like so?
  1. In a new tab, I loaded this page: https://www.youtube.com/user/thesuper36 ... pes/videos
  2. On that page, I clicked this video: "BEST FRIENDS become MORTAL ENEMIES - Civilization V, Part 1"
  3. I clicked the Back button before the video ended, but that loaded the video again instead of the page at step 1.
If that's not what you did, then I'm guessing the problem is with the playlist. I haven't looked into that yet.

If the Browser Console shows nothing when filtering for .user.js, then there aren't any errors in any of your user scripts that have run.

The script won't run on pages that already have &user=… in the URL to avoid adding that twice. That's why the Greasemonkey menu shows "No scripts run on this page" for individual video pages.

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Mon Aug 18, 2014 10:19 pm
by The Binary Son
Gingerbread Man wrote:
The Binary Son wrote:Let me know if there's anything else I can do to help you figure this out - thanks again for your continued help!!!!!
Please update to version 1.2 of the script. It now rewrites links added by the "Load more" button on the channel listing and channel search pages.

Can you tell me exactly what you're doing, step by step, like so?
  1. In a new tab, I loaded this page: https://www.youtube.com/user/thesuper36 ... pes/videos
  2. On that page, I clicked this video: "BEST FRIENDS become MORTAL ENEMIES - Civilization V, Part 1"
  3. I clicked the Back button before the video ended, but that loaded the video again instead of the page at step 1.
If that's not what you did, then I'm guessing the problem is with the playlist. I haven't looked into that yet.

If the Browser Console shows nothing when filtering for .user.js, then there aren't any errors in any of your user scripts that have run.

The script won't run on pages that already have &user=… in the URL to avoid adding that twice. That's why the Greasemonkey menu shows "No scripts run on this page" for individual video pages.
I followed the 3 steps you wrote there, and then played around a bit, and discovered that the back button thing is resolved in SOME situations, but not others. To avoid being confusing trying to type it out, I made a screen capture video with me explaining what I'm doing that will hopefully explain the remaining issues.

https://www.youtube.com/watch?v=bsXGFd8Cp6k

Let me know if you have any further questions and again thanks for helping to figure this out!!!!

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Tue Aug 19, 2014 8:58 am
by Gingerbread Man
"This video is private." That is, it won't play. You could just upload the video to a file host like http://www.firedrive.com.

And I'm sorry to say the playlist situation isn't looking good.

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Tue Aug 19, 2014 3:24 pm
by The Binary Son
I changed it to unlisted the link should work now. Sorry about that please try again.

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Wed Aug 20, 2014 10:16 am
by Gingerbread Man
The problem is that there are numerous pages, and I need to fetch the author account name and match it against the video links. These elements don't necessarily have the same attributes and DOM position across the various types of pages. That's why the script won't automagically work across the whole site; I need to painstakingly handle each scenario.

For future reference, you can see the link target in that little pop up thing in the lower left corner of the window (2:49 in your video). If &user=… is missing there, then the script didn't work like supposed to and you'll run into the Back button annoyance once you click that link.

Stuff I'll check out when I get a chance
  • Subscriptions page - not handled by the script at the moment.
    I don't use YouTube as a logged in user, so I'll have to first subscribe to what seem like prolific users. I'll only be able to test that page once something pops up in my subscription feed.
  • Main page - not handled by the script at the moment.
    I'll have a look at it along with the above.
  • Playlists.
    It doesn't look like there's any way to change what link loads automatically when a video has finished playing. So I might not be able to do anything about them. Also, the account name (e.g. Epzonix) isn't included with the video links, so all I can fetch is the user name (e.g. CMA Músic). I don't even know if these would make for valid Adblock Plus filters, since they can contain spaces and non-Latin characters. If these would work as filters, I could at least modify the links to change what loads when you manually click a video in a playlist.
  • Suggested videos.
    Same no account name / user name only issue as above.
On an unrelated note, you don't need the New Tab Homepage extension. You can configure what opens in each new tab by changing the browser.newtab.url preference in about:config. Alternatively, the Custom New Tab extension lets you control whether focus goes to the address bar or the web page when opening a new tab (the former is the built-in behavior, but if you've set it to something like the Google homepage, you'd likely prefer the latter).

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Posted: Thu Aug 21, 2014 6:31 am
by The Binary Son
Regarding the rest of your post, THANK YOU and I look forward to hearing back from you after you get a chance to look at those different scenarios.
Gingerbread Man wrote:[*]Playlists.
It doesn't look like there's any way to change what link loads automatically when a video has finished playing. So I might not be able to do anything about them. Also, the account name (e.g. Epzonix) isn't included with the video links, so all I can fetch is the user name (e.g. CMA Músic). I don't even know if these would make for valid Adblock Plus filters, since they can contain spaces and non-Latin characters. If these would work as filters, I could at least modify the links to change what loads when you manually click a video in a playlist.
Maybe I'm confused by what you mean by "It doesn't look like there's any way to change what link loads automatically when a video has finished playing," because I just tested a playlist, and the "&user=" thing popped up for all of them. Only weird things I noticed in the links of videos in playlists is that with the exception of the first video of the playlist (assuming you hit play all), all the other videos' links will have "&index=" and then the number that video is in the playlist, somewhere in the link. And it seems to randomly appear in one of either 2 spots: right before the "&user" part or right before the "&list=" part.

The other weird thing I noticed, just looking at my own personal playlists in my own account of others' videos, if I just hit "play all," the "user" listed in the first video will be me, the creator of the playlist.

Again not sure if any of that means anything or if it's stuff you've already noticed, but just fyi.
On an unrelated note, you don't need the New Tab Homepage extension. You can configure what opens in each new tab by changing the browser.newtab.url preference in about:config. Alternatively, the Custom New Tab extension lets you control whether focus goes to the address bar or the web page when opening a new tab (the former is the built-in behavior, but if you've set it to something like the Google homepage, you'd likely prefer the latter).
Thanks! I'll check this out!