Discuss Scratch

scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

I created a userscript that allows you to search the forums!
Here it is:
// ==UserScript==
// @name         Scratch Forums Search
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://scratch.mit.edu/search/*
// @grant        none
// ==/UserScript==
(function() {
document.body.innerHTML+="<div id='gcs'><gcse:searchresults-only></gcse:searchresults-only></div>";
window.eval(`function osr() {
  (function() {
    function addhandler() {
  if (document.querySelector("#___gcse_0 > div > div > div.gsc-results-wrapper-overlay.gsc-results-wrapper-visible > div.gsc-results-close-btn.gsc-results-close-btn-visible")) {
    addreloadonclose()
  } else {
    window.setTimeout(function() {addhandler()}, 15);
  }
}
    function noads() {
  if (document.querySelector(".gsc-wrapper > div")) {
    document.querySelector(".gsc-wrapper > div").outerHTML="";
clearInterval(na)
}
}
var na=window.setInterval(function() {noads()},100)
function addreloadonclose() {
document.querySelector("#___gcse_0 > div > div > div.gsc-results-wrapper-overlay.gsc-results-wrapper-visible > div.gsc-results-close-btn.gsc-results-close-btn-visible").addEventListener("click",function(){location.reload()})
}
addhandler()
    var cx = '012975112532613799384:r7tkav8n1fs';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
}`);
document.querySelector("#view > div > div > div.tab-background > div").innerHTML=document.querySelector("#view > div > div > div.tab-background > div").innerHTML+'<a onclick="osr()" href="#"><li><img title="By File:Speech bubble 2014-02-27 11-11.jpg: King of Wikis derivative work: Bene* [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons" src="https://upload.wikimedia.org/wikipedia/commons/d/de/Speech_bubble_text.svg" class="tab-icon forums"><span>Forums</span></li></a>';
})();

Last edited by scratchyone (Aug. 27, 2016 13:46:25)

jokebookservice1
Scratcher
1000+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

OMG! It works a charm (a part from the ads, but what'ya gonna do)!

I love this! Thanks so much!
scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

jokebookservice1 wrote:

OMG! It works a charm (a part from the ads, but what'ya gonna do)!

I love this! Thanks so much!
Thanks! I wish there was a way to remove them, but then I'd probably have to pay.
jokebookservice1
Scratcher
1000+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

scratchyone wrote:

jokebookservice1 wrote:

OMG! It works a charm (a part from the ads, but what'ya gonna do)!

I love this! Thanks so much!
Thanks! I wish there was a way to remove them, but then I'd probably have to pay.
Use crossorigin.me and then use JS and the DOM to remove them based on their background colour (Probably illegal but oh well..)

Last edited by jokebookservice1 (July 11, 2016 22:34:06)

scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

I updated it to add an adblocker. I don't have an update location, so you will need to add the new version manually. Also, I will be gone camping until friday.
IcyCoder
Scratcher
1000+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

YAY! Thought the ad blocker part is illegal
scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

https://adblockplus.org/blog/restating-the-obvious-adblocking-declared-legal Don't worry, I checked first.

Last edited by scratchyone (July 12, 2016 11:13:39)

PullJosh
Scratcher
1000+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

Awesome script! Works great.
scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

PullJosh wrote:

Awesome script! Works great.
Thanks!
scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

Bump. I fixed it for the new search page!
scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

Don't forget to update. I don't have an update url.
Jonathan50
Scratcher
1000+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

scratchyone wrote:

Bump. I fixed it for the new search page!
The new search and explore pages are so beautiful ;_;
Thank you techoboy10 and designerd!!!!
scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

Jonathan50 wrote:

scratchyone wrote:

Bump. I fixed it for the new search page!
The new search and explore pages are so beautiful ;_;
Thank you techoboy10 and designerd!!!!
Yes ^^^
Sadly, I don't have a good icon, so mine makes it look a little ugly
technoboy10
Scratcher
1000+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

Jonathan50 wrote:

scratchyone wrote:

Bump. I fixed it for the new search page!
The new search and explore pages are so beautiful ;_;
Thank you techoboy10 and designerd!!!!
(also they're mobile friendly with the exception of weird magnifying glass icon positioning, you should try it out!)

Also this is a really cool userscript - my only suggestion would be to try and match the color of the SVG to the color of the inactive SVGs already on the page so it looks even more seamless.

Last edited by technoboy10 (Aug. 27, 2016 22:31:57)

scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

technoboy10 wrote:

Jonathan50 wrote:

scratchyone wrote:

Bump. I fixed it for the new search page!
The new search and explore pages are so beautiful ;_;
Thank you techoboy10 and designerd!!!!
(also they're mobile friendly with the exception of weird magnifying glass icon positioning, you should try it out!)

Also this is a really cool userscript - my only suggestion would be to try and match the color of the SVG to the color of the inactive SVGs already on the page so it looks even more seamless.
Yeah. That's the problem. I don't think I can make one, and that was the best CC one I could find… Anybody have a suggestion for an icon?
IcyCoder
Scratcher
1000+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

Wow works great!
Jonathan50
Scratcher
1000+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

Yay, this is much better than searching “site:scratch.mit.edu/discuss/ …” in Google
scratchyone
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

Thanks!
docaiden
Scratcher
100+ posts

Re-Enable Forums Search Userscript [Works with the new search!]

Thats so awesome im giving you 5 internets.

Powered by DjangoBB