@@ -121,3 +121,281 @@ let response = await fetch(`${apiUrl}/votes?videoId=${videoId}&likeCount=`, {
121121 . catch ( ( e ) => alert ( "ERROR: " + e ) ) ;
122122
123123console . log ( response ) ;
124+
125+ // reddit toolkit: https://codepen.io/bookmarklets/pen/Noxwme?editors=1010
126+ javascript: if ( window . location . hostname . includes ( "reddit" ) ) {
127+ if ( document . getElementById ( "mymenu" ) ) {
128+ document . getElementById ( "mymenu" ) . remove ( ) ;
129+ } else {
130+ function switcher ( ) {
131+ var url = location . href ;
132+ if ( url . includes ( "www" ) ) {
133+ var url = url . replace ( "www" , "old" ) ;
134+ window . open ( url , "_self" ) ;
135+ } else if ( url . includes ( "new" ) ) {
136+ var url = url . replace ( "new" , "old" ) ;
137+ window . open ( url , "_self" ) ;
138+ } else {
139+ var url = url . replace ( "old" , "www" ) ;
140+ window . open ( url , "_self" ) ;
141+ }
142+ }
143+ var switchIt = `<a style=color:#00FF00; href=# onClick=switcher()
144+ title=Switch between old and new Reddit>Old/New Reddit</a>` ;
145+ function upVote ( ) {
146+ if (
147+ window . location . href . indexOf ( "old.reddit.com/r/" ) > - 1 ||
148+ window . location . href . indexOf ( "old.reddit.com/u/" ) > - 1
149+ ) {
150+ ( function ( ) {
151+ var q = [ ] ;
152+ $ ( ".up" ) . each ( function ( ) {
153+ var that = this ;
154+ var f = function ( index ) {
155+ $ ( that ) . trigger ( "click" ) ;
156+ $ ( that ) . trigger ( "mousedown" ) ;
157+ setTimeout ( function ( ) {
158+ if ( q [ index ] ) {
159+ q [ index ] ( index + 1 ) ;
160+ } else {
161+ if ( upVoteTimer ) {
162+ window . clearTimeout ( upVoteTimer ) ;
163+ }
164+ }
165+ } , 500 ) ;
166+ } ;
167+ q . push ( f ) ;
168+ } ) ;
169+ var upVoteTimer = window . setTimeout ( function ( ) {
170+ q [ 0 ] ( 1 ) ;
171+ } , 50 ) ;
172+ } ) ( ) ;
173+ } else if ( window . location . href . indexOf ( "old.reddit.com/user/" ) > - 1 ) {
174+ void ! ( function ( ) {
175+ document
176+ . querySelectorAll ( '[data-event-action="upvote"]' )
177+ . forEach ( function ( o ) {
178+ "upvote" === o . dataset . eventAction && o . click ( ) ;
179+ } ) ,
180+ document . querySelectorAll ( ".icon-upvote" ) . forEach ( function ( o ) {
181+ o . click ( ) ;
182+ } ) ;
183+ } ) ( ) ;
184+ } else {
185+ alert ( `You need to be voting in a single sub or user page in OLD reddit for this to work!\nSWITCH TO OLD REDDIT!\n
186+ Go to: http://old.reddit.com/r/ and choose a subreddit or user to vote on!` ) ;
187+ }
188+ }
189+ var upVoteIt =
190+ "<a style=color:#00FF00; href=# onClick=upVote() title=UpVote All (Works Only in OLD Reddit)>↑ UpVote All</a>" ;
191+ function downVote ( ) {
192+ if (
193+ window . location . href . indexOf ( "old.reddit.com/r/" ) > - 1 ||
194+ window . location . href . indexOf ( "old.reddit.com/u/" ) > - 1
195+ ) {
196+ ( function ( ) {
197+ var q = [ ] ;
198+ $ ( ".down" ) . each ( function ( ) {
199+ var that = this ;
200+ var f = function ( index ) {
201+ $ ( that ) . trigger ( "click" ) ;
202+ $ ( that ) . trigger ( "mousedown" ) ;
203+ setTimeout ( function ( ) {
204+ if ( q [ index ] ) {
205+ q [ index ] ( index + 1 ) ;
206+ } else {
207+ if ( downVoteTimer ) {
208+ window . clearTimeout ( downVoteTimer ) ;
209+ }
210+ }
211+ } , 500 ) ;
212+ } ;
213+ q . push ( f ) ;
214+ } ) ;
215+ var downVoteTimer = window . setTimeout ( function ( ) {
216+ q [ 0 ] ( 1 ) ;
217+ } , 50 ) ;
218+ } ) ( ) ;
219+ } else if ( window . location . href . indexOf ( "old.reddit.com/user/" ) > - 1 ) {
220+ void ! ( function ( ) {
221+ document
222+ . querySelectorAll ( '[data-event-action="downvote"]' )
223+ . forEach ( function ( o ) {
224+ "downvote" === o . dataset . eventAction && o . click ( ) ;
225+ } ) ,
226+ document . querySelectorAll ( ".icon-downvote" ) . forEach ( function ( o ) {
227+ o . click ( ) ;
228+ } ) ;
229+ } ) ( ) ;
230+ } else {
231+ alert ( `You need to be voting in a single sub in OLD reddit for this to work!\nSWITCH TO OLD REDDIT!\n
232+ Go to: http://old.reddit.com/r/ and choose a subreddit` ) ;
233+ }
234+ }
235+ var downVoteIt =
236+ "<a style=color:#00FF00; href=# onClick=downVote() title=DownVote All(Works Only in OLD Reddit)>↓ DownVote All</a>" ;
237+ function stealth ( ) {
238+ if ( window . location . href . indexOf ( "old.reddit.com" ) > - 1 ) {
239+ ( function ( ) {
240+ var newcss =
241+ ".midcol, .thumbnail, .rank, .flairichtext, .flaircolordark, .linkflairlabel, .flaircolorlight, .res-flairSearch {display:none} .title {color:black !important} .title{font-size:120% !important} body {background-color:white}" ;
242+ if ( "\v" == "v" ) {
243+ document . createStyleSheet ( ) . cssText = newcss ;
244+ } else {
245+ var tag = document . createElement ( "style" ) ;
246+ tag . type = "text/css" ;
247+ document . getElementsByTagName ( "head" ) [ 0 ] . appendChild ( tag ) ;
248+ tag [
249+ typeof document . body . style . WebkitAppearance == "string"
250+ ? "innerText"
251+ : "innerHTML"
252+ ] = newcss ;
253+ }
254+ } ) ( ) ;
255+ document . getElementsByClassName ( "side" ) [ 0 ] . remove ( ) ;
256+ document . getElementById ( "header" ) . remove ( ) ;
257+ document . getElementsByClassName ( "panestack-title" ) [ 0 ] . remove ( ) ;
258+ document . getElementsByClassName ( "menuarea" ) [ 0 ] . remove ( ) ;
259+ document . getElementsByClassName ( "usertext cloneable" ) [ 0 ] . remove ( ) ;
260+ document . getElementsByName ( "content" ) [ 0 ] . remove ( ) ;
261+ document . getElementsByClassName ( "footer-parent" ) [ 0 ] . remove ( ) ;
262+ } else if ( window . location . href . indexOf ( "reddit.com" ) > - 1 ) {
263+ ( function ( ) {
264+ ( function ( ) {
265+ var i ,
266+ elements = document . querySelectorAll ( "body *" ) ;
267+ for ( i = 0 ; i < elements . length ; i ++ ) {
268+ if ( getComputedStyle ( elements [ i ] ) . position === "fixed" ) {
269+ elements [ i ] . parentNode . removeChild ( elements [ i ] ) ;
270+ }
271+ }
272+ } ) ( ) ;
273+ } ) ( ) ;
274+
275+ ( function ( ) {
276+ var e = document . getElementsByClassName ( "s7pq5uy-6" ) || "jspfgX" ;
277+ if ( e [ 0 ] . style . display == "none" ) {
278+ e [ 0 ] . style . display = "block" ;
279+ } else {
280+ e [ 0 ] . style . display = "none" ;
281+ }
282+ } ) ( ) ;
283+ } else {
284+ alert (
285+ "You need to be on Reddit.com for this bookmarklet to work!\nStealth mode looks best on old.reddit.com!"
286+ ) ;
287+ }
288+ }
289+ var stealthIt =
290+ "<a style=color:#00FF00; href=# onClick=stealth() title=This works best in OLD Reddit>Stealth Mode</a>" ;
291+ function coder ( ) {
292+ ( function ( ) {
293+ var newcss =
294+ ".midcol, .thumbnail, .rank, .flairichtext, .flaircolordark, .linkflairlabel, .flaircolorlight, .res-flairSearch {display:none} .title {color:green !important} .title{font-size:120% !important} body {background-color:black}" ;
295+ if ( "\v" == "v" ) {
296+ document . createStyleSheet ( ) . cssText = newcss ;
297+ } else {
298+ var tag = document . createElement ( "style" ) ;
299+ tag . type = "text/css" ;
300+ document . getElementsByTagName ( "head" ) [ 0 ] . appendChild ( tag ) ;
301+ tag [
302+ typeof document . body . style . WebkitAppearance == "string"
303+ ? "innerText"
304+ : "innerHTML"
305+ ] = newcss ;
306+ }
307+ } ) ( ) ;
308+ document . getElementsByClassName ( "side" ) [ 0 ] . remove ( ) ;
309+ document . getElementById ( "header" ) . remove ( ) ;
310+ document . getElementsByClassName ( "panestack-title" ) [ 0 ] . remove ( ) ;
311+ document . getElementsByClassName ( "menuarea" ) [ 0 ] . remove ( ) ;
312+ document . getElementsByClassName ( "usertext cloneable" ) [ 0 ] . remove ( ) ;
313+ document . getElementsByName ( "content" ) [ 0 ] . remove ( ) ;
314+ document . getElementsByClassName ( "footer-parent" ) [ 0 ] . remove ( ) ;
315+ }
316+ var coderIt =
317+ "<a style=color:#00FF00; href=# onClick=coder() title=This only works in OLD Reddit>Coder Mode</a>" ;
318+ function baseTag ( ) {
319+ var insertBase ;
320+ var baseTag ;
321+ insertBase = document . createElement ( "base" ) ;
322+ insertBase . id = "myBase" ;
323+ insertBase . innerHTML = "<base target=_blank>" ;
324+ container_block = document . getElementsByTagName ( "head" ) [ 0 ] ;
325+ container_block . appendChild ( insertBase ) ;
326+ }
327+ var NewTabIt =
328+ "<a style=color:#00FF00; href=# onClick=baseTag();return false; title=Opens all links in a new tab when clicked>OpenInNewTab</a>" ;
329+ function getVid ( ) {
330+ var url = location . href ;
331+ if ( url . includes ( "old" ) ) {
332+ var url = url . replace ( "old" , "www" ) ;
333+ }
334+ window . open ( "https://redv.co/?url=" + url ) ;
335+ }
336+ var downloadVid =
337+ "<a style=color:#00FF00; href=# onClick=getVid(); title=Download Reddit Videos>GetRedditVideo</a>" ;
338+ if ( window . location . href . includes ( "old" ) ) {
339+ var notice = "" ;
340+ var spacer = "<span style=color:#777>.......</span>" ;
341+ } else {
342+ var notice =
343+ "<br /><sub><br /><i style=font-style:italic;color:#00FFFF;cursor:pointer><a onClick=makeOld() id=demo onMouseOver=replaceText() onMouseOut=original()>This works best<br />in OLD REDDIT</a></i></sub>" ;
344+ var spacer = "<span style=color:#777>..........</span>" ;
345+ }
346+ function hideMenu ( ) {
347+ document . getElementById ( "mymenu" ) . remove ( ) ;
348+ }
349+ function replaceText ( ) {
350+ document . getElementById ( "demo" ) . innerHTML =
351+ " Click to switch <br />to OLD REDDIT" ;
352+ }
353+ function original ( ) {
354+ document . getElementById ( "demo" ) . innerHTML =
355+ "This works best<br />in OLD REDDIT" ;
356+ }
357+ function makeOld ( ) {
358+ var url = document . location . href ;
359+ var url = url . replace ( "www" , "old" ) ;
360+ var url = url . replace ( "new" , "old" ) ;
361+ window . open ( url , "_self" ) ;
362+ }
363+ function infoPop ( ) {
364+ var a = `<div style:padding:10px;><img src=http://reddit.com/favicon.ico /><br />
365+ <h2>Welcome to the Reddit Toolkit!</h2>
366+ <ul>
367+ <li>Upvote all will up vote all all of the posts on a subreddit or even of an individual user. This will work even for subs that you are not subscribed to!<br />
368+ <i style=color:red>CAVEAT! Be careful - Reddit keeps counts of total votes on a sub and user pages. Overuse will mean your votes will not be counted. Abuse can get you shadowbanned!</i></li>
369+ <li>Downvote all will down vote all all of the posts on a subreddit or even of an individual user. This will work even for subs that you are not subscribed to!<br />
370+ <i style=color:red>CAVEAT! - See above!</i></li>
371+ <li>Old/New Reddit toggle. This will toggle between old and new Reddit. Most of these tools ONLY work in Old Reddit.</li>
372+ <li>Stealth Mode. This will hide much of the graphics and headers/footers that give away the fact that you are surfing Reddit. Often used by people who are at work.</li>
373+ <li>Coder Mode. Looks like you have some kind of coding interface open. Another way of reading Reddit when you are supposed to be doing something else!</li>
374+ <li>OpenInNewTab. Clicking this will not make any visible changes on the page, however, all of the links you click on will open in a new tab!</li>
375+ <li>GetRedditVideo - This will open an interface that will let you download a Reddit hosted video.</li>
376+ </ul><center><h2><a href=https://www.zazzle.com/cats_and_dogs/products>Cat Tax</a></h2></center></div>` ;
377+ w = window . open ( "" , "Links" , "scrollbars,resizable,width=400,height=675" ) ;
378+ w . document . write ( a ) ;
379+ }
380+ var block_to_insert ;
381+ var container_block ;
382+ block_to_insert = document . createElement ( "div" ) ;
383+ block_to_insert . id = "mymenu" ;
384+ block_to_insert . innerHTML =
385+ `<a href=# onclick=hideMenu() title=Close style=font-weight:bold;color:#F00>×</a>' + spacer +'<a href=https://www.zazzle.com/cats_and_dogs/products><img src=https://www.reddit.com/favicon.ico height=15 width=15 /></a>' + spacer + '<a href=# onClick=infoPop() style=color:#FFF;font-weight:bold;size:150%; title=Information>ⓘ</a>
386+ <br /><hr />' + upVoteIt + '<br /><hr />'+ downVoteIt +'<br /><hr />'+switchIt+'<br /><hr />' + stealthIt + '<br /><hr />' + coderIt + '<hr/>'+ NewTabIt + '<br /><hr />` +
387+ downloadVid +
388+ notice ;
389+ container_block = document . getElementsByTagName ( "body" ) [ 0 ] ;
390+ container_block . appendChild ( block_to_insert ) ;
391+ mymenu . setAttribute (
392+ "style" ,
393+ "height:240px; width:100px; border-radius:0px 0px 10px 0px; background-color:#000; color:red; float:left; font-size:12px; z-index:10000; display:block; overflow:visible; position:fixed; top: 0; padding:2px 5px;"
394+ ) ;
395+ }
396+ } else {
397+ alert (
398+ "NOT REDDIT\nThis tool only works on Reddit.\nRedirecting you to Reddit.com"
399+ ) ;
400+ window . open ( "http://old.reddit.com" , "_self" ) ;
401+ }
0 commit comments