Compare commits
	
		
			33 commits
		
	
	
		
			
				u/comishq-
			
			...
			
				u/master
			
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 63048a34ea | |||
| 0e9e91bf60 | |||
| e61fdbdbd3 | |||
| 5db7867f46 | |||
| 89ef621228 | |||
| d7dfdba8dd | |||
| 0b85f0b053 | |||
| e9a6ffd2b8 | |||
| 89e31c5006 | |||
| 6c64213999 | |||
| 6de306fd36 | |||
| 409d0de43f | |||
| ab659cfc89 | |||
| 606bba9c55 | |||
| 057e728111 | |||
| ed63fc1206 | |||
| 8766d09bc0 | |||
| 10d7bbc64a | |||
| 941da9e4eb | |||
| 6941f880ae | |||
| 3d9a36abfb | |||
|  | 28bad45970 | ||
|  | 788efc9e90 | ||
|  | 5a95d4a17a | ||
|  | 944b1e85b1 | ||
|  | 78dfa16b53 | ||
|  | 076edd0aa3 | ||
|  | 9263e238d8 | ||
|  | 3ceb2d5f60 | ||
|  | 69c85131f0 | ||
|  | a3699fb789 | ||
|  | 29af9ccc56 | ||
|  | 95f1340722 | 
					 15 changed files with 851 additions and 82 deletions
				
			
		|  | @ -4,59 +4,66 @@ | ||||||
| // @description Allow removal of visited links on Amazon Giveaway Listing
 | // @description Allow removal of visited links on Amazon Giveaway Listing
 | ||||||
| // @include https://smile.amazon.com/ga/giveaways*
 | // @include https://smile.amazon.com/ga/giveaways*
 | ||||||
| // @include https://www.amazon.com/ga/giveaways*
 | // @include https://www.amazon.com/ga/giveaways*
 | ||||||
| // @version 1.8.0
 | // @version 1.9.2
 | ||||||
| // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
 | // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
 | ||||||
| // ==/UserScript==
 | // ==/UserScript==
 | ||||||
| 
 | 
 | ||||||
| var checked = false; | /* global jQuery */ | ||||||
| var regex_hide; | /* jshint esversion: 6 */ | ||||||
| 
 | 
 | ||||||
| var getSmallUrl = function(fullUrl) { | (function ($) { | ||||||
|   return fullUrl.split('?')[0]; |   'use strict'; | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| var hideOne = function(el) { |   var checked = false; | ||||||
|   $(el).parents('.giveawayItemContainer').css('display', checked ? 'none' : 'block'); |   var regex_hide; | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| var hideVisited = function(evt) { |   var getSmallUrl = function(fullUrl) { | ||||||
|   checked = $(this).prop('checked'); |     return fullUrl.split('?')[0]; | ||||||
|   var $links = $('#giveaway-grid a[href*="amazon.com/ga"]'); |   }; | ||||||
| 
 | 
 | ||||||
|   var hide = regex_hide ? new RegExp(regex_hide, 'i') : null; |   var hideOne = function(el) { | ||||||
|  |     $(el).parents('.listing-item').css('display', checked ? 'none' : 'block'); | ||||||
|  |   }; | ||||||
| 
 | 
 | ||||||
|   $links.each(function() { |   var hideVisited = function(evt) { | ||||||
|     var href = getSmallUrl($(this).attr('href')); |     checked = $(this).prop('checked'); | ||||||
|     if (localStorage.getItem(href)) { |     var $links = $('.listing-info-container a[href*="/ga"]'); | ||||||
|  | 
 | ||||||
|  |     var hide = regex_hide ? new RegExp(regex_hide, 'i') : null; | ||||||
|  | 
 | ||||||
|  |     $links.each(function() { | ||||||
|  |       var href = getSmallUrl($(this).attr('href')); | ||||||
|  |       if (localStorage.getItem(href)) { | ||||||
|  |         hideOne(this); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       var title = $(this).find('.prize-title').text(); | ||||||
|  |       if (hide && title && hide.test(title)) { | ||||||
|  |         hideOne(this); | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   $(document).ready(function() { | ||||||
|  |     $('.listing-info-container').on('click', 'a[href*="/ga"]', function(evt) { | ||||||
|  |       var href = getSmallUrl($(this).attr('href')); | ||||||
|  |       localStorage[href] = "visited"; | ||||||
|       hideOne(this); |       hideOne(this); | ||||||
|     } |     }); | ||||||
| 
 | 
 | ||||||
|     var title = $(this).find('.giveawayPrizeNameContainer').text(); |     $('.listing-info-container a[href*="/ga"]').attr('target', '_blank'); | ||||||
|     if (hide && title && hide.test(title)) { |  | ||||||
|       hideOne(this); |  | ||||||
|     } |  | ||||||
|   }); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| $(document).ready(function() { |     regex_hide = localStorage.getItem('regex_hide') || ''; | ||||||
|   $('head').append('<base target="_blank" />'); |  | ||||||
| 
 | 
 | ||||||
|   $('#giveaway-grid').on('click', 'a[href*="amazon.com/ga"]', function(evt) { |     $('#giveaway-numbers-container') | ||||||
|  |       .append('<label><input type="checkbox" id="hide_visited"/> Visited</label>') | ||||||
|  |       .append(`<input id="hide_regex" value="${regex_hide}"/>`); | ||||||
| 
 | 
 | ||||||
|     var href = getSmallUrl($(this).attr('href')); |     $('#hide_visited').on('click', hideVisited); | ||||||
|     localStorage[href] = "visited"; |     $('#hide_regex').on('change', function() { | ||||||
|     hideOne(this); |       regex_hide = $(this).val(); | ||||||
|  |       localStorage.regex_hide = regex_hide; | ||||||
|  |     }); | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   regex_hide = localStorage.getItem('regex_hide') || ''; | })(jQuery); | ||||||
| 
 |  | ||||||
|   $('#giveaway-result-info-bar-content') |  | ||||||
|     .append('<label><input type="checkbox" id="hide_visited"/> Visited</label>') |  | ||||||
|     .append(`<input id="hide_regex" value="${regex_hide}"/>`); |  | ||||||
| 
 |  | ||||||
|   $('#hide_visited').on('click', hideVisited); |  | ||||||
|   $('#hide_regex').on('change', function() { |  | ||||||
|     regex_hide = $(this).val(); |  | ||||||
|     localStorage.regex_hide = regex_hide; |  | ||||||
|   }); |  | ||||||
| }); |  | ||||||
|  |  | ||||||
							
								
								
									
										89
									
								
								comicextra.user.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								comicextra.user.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,89 @@ | ||||||
|  | // -*- tab-width: 4; js-indent-level: 4; -*-
 | ||||||
|  | // ==UserScript==
 | ||||||
|  | // @name         Comic Extra Scraper
 | ||||||
|  | // @namespace    danielrayjones
 | ||||||
|  | // @version      0.0.6
 | ||||||
|  | // @description  Scrape comics from comicextra.com
 | ||||||
|  | // @author       Dan Jones
 | ||||||
|  | // @match        https://www.comicextra.com/*
 | ||||||
|  | // @grant        none
 | ||||||
|  | // @require      https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
 | ||||||
|  | // @require      https://bowercdn.net/c/konami-code-1.3.2/src/jquery.konami.min.js
 | ||||||
|  | // @require      https://bowercdn.net/c/jszip-3.1.5/dist/jszip.min.js
 | ||||||
|  | // ==/UserScript==
 | ||||||
|  | 
 | ||||||
|  | /* global jQuery, JSZip */ | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
|  | console.log('will scrape comics'); | ||||||
|  | 
 | ||||||
|  | (function($) { | ||||||
|  |     'use strict'; | ||||||
|  | 
 | ||||||
|  |     $(window).konami({ | ||||||
|  |         code: [71,69,84], | ||||||
|  |         cheat: getStuff | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     function getStuff() { | ||||||
|  |         let i = 0; | ||||||
|  | 
 | ||||||
|  |         let path = location.pathname.split('/'); | ||||||
|  |         let end = path.pop(); | ||||||
|  |         while (!end && path.length) { | ||||||
|  |             end = path.pop(); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (end !== 'full') { | ||||||
|  |             alert('Must have the full comic'); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         let chapter = path.pop(); | ||||||
|  |         let match; | ||||||
|  |         if ((match = chapter.match(/^chapter-([0-9]+)/))) { | ||||||
|  |             chapter = match[1]; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         let name = path.pop(); | ||||||
|  | 
 | ||||||
|  |         console.log(`Getting ${name} ${chapter}`); | ||||||
|  | 
 | ||||||
|  |         let imgs = $('.chapter-main .chapter_img').toArray(); | ||||||
|  |         console.log(imgs); | ||||||
|  | 
 | ||||||
|  |         let cbz = new JSZip(); | ||||||
|  | 
 | ||||||
|  |         function downloadCbz() { | ||||||
|  |             cbz.generateAsync({type: 'blob'}) | ||||||
|  |                 .then(blob => { | ||||||
|  |                     let title = name.replace(/-/g, ' ') + ' ' + chapter; | ||||||
|  | 
 | ||||||
|  |                     let $el = $('<a>'); | ||||||
|  |                     $(document.body).append($el); | ||||||
|  |                     $el.attr('href', URL.createObjectURL(blob)); | ||||||
|  |                     $el.attr('download', `${title} (comicextra) (Danjones).cbz`); | ||||||
|  |                     $el.get(0).click(); | ||||||
|  |                 }); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         function getOne() { | ||||||
|  |             if (!imgs || !imgs.length) { | ||||||
|  |                 downloadCbz(); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             let img = imgs.shift(); | ||||||
|  |             console.log(img.src); | ||||||
|  | 
 | ||||||
|  |             fetch(`//cors-anywhere.herokuapp.com/${img.src}`).then(resp => resp.blob()).then(blob => { | ||||||
|  |                 cbz.file(name + '-' + (i < 10 ? '00' : '0' ) + i + '.jpg', blob); | ||||||
|  | 
 | ||||||
|  |                 i = i+1; | ||||||
|  |                 setTimeout(getOne, 0); | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         getOne(); | ||||||
|  |     } | ||||||
|  | })(jQuery); | ||||||
							
								
								
									
										45
									
								
								cookie.clicker.user.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								cookie.clicker.user.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | ||||||
|  | // ==UserScript==
 | ||||||
|  | // @name Auto Cookie Clicker
 | ||||||
|  | // @namespace danielrayjones
 | ||||||
|  | // @description Plays Cookie Clicker for you
 | ||||||
|  | // @include http://orteil.dashnet.org/cookieclicker/
 | ||||||
|  | // @version 0.0.4
 | ||||||
|  | // ==/UserScript==
 | ||||||
|  | 
 | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
|  | let AutoClicker = {stop: false}; | ||||||
|  | unsafeWindow.AutoClicker = AutoClicker; | ||||||
|  | 
 | ||||||
|  | window.addEventListener('load', function () { | ||||||
|  |   'use strict'; | ||||||
|  | 
 | ||||||
|  |   let cookie = document.getElementById('bigCookie'); | ||||||
|  |   let shimmers = document.getElementById('shimmers'); | ||||||
|  | 
 | ||||||
|  |   function clickCookie() { | ||||||
|  |     AutoClicker.cookie.click(); | ||||||
|  |     if (!AutoClicker.stop) { | ||||||
|  |       setTimeout(clickCookie, 5); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   let shimmerObserver = new MutationObserver(function (mutations) { | ||||||
|  |     mutations.forEach(function (mutation) { | ||||||
|  |       mutation.addedNodes.forEach(function (shimmer) { | ||||||
|  |         console.log('clicking', shimmer); | ||||||
|  |         shimmer.click(); | ||||||
|  |       }); | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  |   shimmerObserver.observe(shimmers, { childList: true}); | ||||||
|  | 
 | ||||||
|  |   AutoClicker.cookie = cookie; | ||||||
|  |   AutoClicker.shimmers = shimmers; | ||||||
|  |   AutoClicker.clickCookie = clickCookie; | ||||||
|  |   AutoClicker.shimmerObserver = shimmerObserver; | ||||||
|  | 
 | ||||||
|  |   for (let i = 0; i < 20; i++) { | ||||||
|  |     clickCookie(); | ||||||
|  |   } | ||||||
|  | }); | ||||||
							
								
								
									
										85
									
								
								fullcomic.user.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								fullcomic.user.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,85 @@ | ||||||
|  | // -*- tab-width: 4; js-indent-level: 4; -*-
 | ||||||
|  | // ==UserScript==
 | ||||||
|  | // @name         Full Comic Scraper
 | ||||||
|  | // @namespace    danielrayjones
 | ||||||
|  | // @version      0.0.5
 | ||||||
|  | // @description  Scrape comics from fullcomic.pro
 | ||||||
|  | // @author       Dan Jones
 | ||||||
|  | // @match        http://fullcomic.pro/*
 | ||||||
|  | // @grant        none
 | ||||||
|  | // @require      https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
 | ||||||
|  | // @require      https://bowercdn.net/c/konami-code-1.3.2/src/jquery.konami.min.js
 | ||||||
|  | // @require      https://bowercdn.net/c/jszip-3.1.5/dist/jszip.min.js
 | ||||||
|  | // ==/UserScript==
 | ||||||
|  | 
 | ||||||
|  | /* global jQuery, JSZip */ | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
|  | console.log('will scrape comics'); | ||||||
|  | 
 | ||||||
|  | (function($) { | ||||||
|  |     'use strict'; | ||||||
|  | 
 | ||||||
|  |     $(window).konami({ | ||||||
|  |         code: [71,69,84], | ||||||
|  |         cheat: getStuff | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     function getStuff() { | ||||||
|  |         let i = 0; | ||||||
|  | 
 | ||||||
|  |         let title = $('.title h1').text(); | ||||||
|  | 
 | ||||||
|  |         let regex = /Issue #([0-9]+)/; | ||||||
|  |         let match; | ||||||
|  |         if ((match = title.match(regex))) { | ||||||
|  |             let issue = match[1]; | ||||||
|  |             while (issue.length < 3) { | ||||||
|  |                 issue = '0' + issue; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             title = title.replace(regex, issue); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         console.log(`Getting ${title}`); | ||||||
|  | 
 | ||||||
|  |         let imgs = $('#imgPages img').toArray(); | ||||||
|  |         console.log(imgs); | ||||||
|  | 
 | ||||||
|  |         let cbz = new JSZip(); | ||||||
|  | 
 | ||||||
|  |         function downloadCbz() { | ||||||
|  |             cbz.generateAsync({type: 'blob'}) | ||||||
|  |                 .then(blob => { | ||||||
|  |                     let fileTitle = title.replace(/: /g, ' - '); | ||||||
|  | 
 | ||||||
|  |                     let $el = $('<a>'); | ||||||
|  |                     $(document.body).append($el); | ||||||
|  |                     $el.attr('href', URL.createObjectURL(blob)); | ||||||
|  |                     $el.attr('download', `${fileTitle} (fullcomic) (Danjones).cbz`); | ||||||
|  |                     $el.get(0).click(); | ||||||
|  |                 }); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         function getOne() { | ||||||
|  |             if (!imgs || !imgs.length) { | ||||||
|  |                 downloadCbz(); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             let img = imgs.shift(); | ||||||
|  |             console.log(img.src); | ||||||
|  | 
 | ||||||
|  |             fetch(`//cors-anywhere.herokuapp.com/${img.src}`).then(resp => resp.blob()).then(blob => { | ||||||
|  |                 let name = title.replace(/[^A-Za-z0-9]+/g, '-'); | ||||||
|  | 
 | ||||||
|  |                 cbz.file(name + '-' + (i < 10 ? '00' : '0' ) + i + '.jpg', blob); | ||||||
|  | 
 | ||||||
|  |                 i = i+1; | ||||||
|  |                 setTimeout(getOne, 0); | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         getOne(); | ||||||
|  |     } | ||||||
|  | })(jQuery); | ||||||
|  | @ -3,11 +3,12 @@ | ||||||
| // @namespace danielrayjones
 | // @namespace danielrayjones
 | ||||||
| // @description Remove stuff I don't like from Amazon Giveaway Listing
 | // @description Remove stuff I don't like from Amazon Giveaway Listing
 | ||||||
| // @include https://giveawaylisting.com/
 | // @include https://giveawaylisting.com/
 | ||||||
| // @version 1.0
 | // @version 1.0.1
 | ||||||
| // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
 | // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
 | ||||||
| // ==/UserScript==
 | // ==/UserScript==
 | ||||||
| 
 | 
 | ||||||
| /* global $ */ | /* global $ */ | ||||||
|  | /* jshint esversion: 6 */ | ||||||
| 
 | 
 | ||||||
| var hide = function(text) { | var hide = function(text) { | ||||||
|   $('#giveaways a:contains("' + text +'")') |   $('#giveaways a:contains("' + text +'")') | ||||||
|  |  | ||||||
|  | @ -3,10 +3,12 @@ | ||||||
| // @namespace danielrayjones
 | // @namespace danielrayjones
 | ||||||
| // @description Allow removal of visited links on Amazon Giveaway Listing
 | // @description Allow removal of visited links on Amazon Giveaway Listing
 | ||||||
| // @include https://giveawaylisting.com/
 | // @include https://giveawaylisting.com/
 | ||||||
| // @version 1.3
 | // @version 1.3.1
 | ||||||
| // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
 | // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
 | ||||||
| // ==/UserScript==
 | // ==/UserScript==
 | ||||||
| 
 | 
 | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
| var checked = false; | var checked = false; | ||||||
| 
 | 
 | ||||||
| var hideOne = function(el) { | var hideOne = function(el) { | ||||||
|  |  | ||||||
							
								
								
									
										143
									
								
								infinite-craft-plus.user.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										143
									
								
								infinite-craft-plus.user.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,143 @@ | ||||||
|  | // ==UserScript==
 | ||||||
|  | // @name        Infinite Craft Plus
 | ||||||
|  | // @namespace   danielrayjones
 | ||||||
|  | // @match       https://neal.fun/infinite-craft/
 | ||||||
|  | // @grant       none
 | ||||||
|  | // @version     0.0.1
 | ||||||
|  | // @author      Dan Jones
 | ||||||
|  | // @description 2024-01-06T14:13:00-0500
 | ||||||
|  | // ==/UserScript==
 | ||||||
|  | 
 | ||||||
|  | /* global window, localStorage, FileReader */ | ||||||
|  | 
 | ||||||
|  | (function () { | ||||||
|  |   const key = "infinite-craft-data"; | ||||||
|  | 
 | ||||||
|  |   function getData() { | ||||||
|  |     return localStorage.getItem(key); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function downloadData() { | ||||||
|  |     const data = getData(); | ||||||
|  | 
 | ||||||
|  |     const dl = document.createElement('a'); | ||||||
|  |     dl.href = 'data:application/json,' + data; | ||||||
|  |     dl.download = 'infinite-craft.json'; | ||||||
|  | 
 | ||||||
|  |     dl.click(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function getParsedData() { | ||||||
|  |     return JSON.parse(getData()); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function getElements() { | ||||||
|  |     return getParsedData().elements; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function overwriteElements(newElements) { | ||||||
|  |       const data = getParsedData(); | ||||||
|  |       const old = data.elements; | ||||||
|  |       data.elements = newElements; | ||||||
|  | 
 | ||||||
|  |       localStorage.setItem(key, JSON.stringify(data)); | ||||||
|  | 
 | ||||||
|  |       return old; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function addElements(newElements) { | ||||||
|  |       const els = getElements(); | ||||||
|  | 
 | ||||||
|  |       for (let i = 0; i < newElements.length; i++) { | ||||||
|  |           const newEl = newElements[i]; | ||||||
|  |           const found = els.find(el => el.text === newEl.text); | ||||||
|  |           if (found) { | ||||||
|  |               continue; | ||||||
|  |           } | ||||||
|  | 
 | ||||||
|  |           console.log('Adding', newEl); | ||||||
|  | 
 | ||||||
|  |           els.push(newEl); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       return overwriteElements(els); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function uploadElements(evt) { | ||||||
|  |     evt.preventDefault(); | ||||||
|  |     const files = evt.target.uploads.files; | ||||||
|  | 
 | ||||||
|  |     for (let i = 0; i < files.length; i++) { | ||||||
|  |       const file = files[i]; | ||||||
|  |       const read = new FileReader(); | ||||||
|  |       read.addEventListener('load', function () { | ||||||
|  |         const body = read.result; | ||||||
|  |         const els = JSON.parse(body)?.elements; | ||||||
|  |         addElements(els); | ||||||
|  |       }); | ||||||
|  |       read.readAsText(file); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     const sub = evt.target.lastChild; | ||||||
|  |     sub.disabled = true; | ||||||
|  |     sub.setAttribute('value', '✅'); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function getUploadButton() { | ||||||
|  |     const f = document.createElement('form'); | ||||||
|  |     f.style.display = 'inline'; | ||||||
|  | 
 | ||||||
|  |     const ups = document.createElement('input'); | ||||||
|  |     ups.setAttribute('type', 'file'); | ||||||
|  |     ups.setAttribute('name', 'uploads'); | ||||||
|  |     ups.setAttribute('accept', '.json'); | ||||||
|  |     ups.setAttribute('required', true); | ||||||
|  |     f.appendChild(ups); | ||||||
|  | 
 | ||||||
|  |     f.addEventListener('submit', uploadElements); | ||||||
|  | 
 | ||||||
|  |     const sub = document.createElement('input'); | ||||||
|  |     sub.setAttribute('type', 'submit'); | ||||||
|  |     sub.setAttribute('value', 'Upload'); | ||||||
|  |     f.appendChild(sub); | ||||||
|  | 
 | ||||||
|  |     return f; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function getDownloadButton() { | ||||||
|  |     const butt = document.createElement('button'); | ||||||
|  |     butt.innerText = '⤵️'; | ||||||
|  |     butt.addEventListener('click', downloadData); | ||||||
|  | 
 | ||||||
|  |     return butt; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function addButtons() { | ||||||
|  |     const target = document.querySelector('.site-title')?.parentElement; | ||||||
|  |     if (!target) { | ||||||
|  |       console.log("Can't find .site-title"); | ||||||
|  |       return null; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     const span = document.createElement('span'); | ||||||
|  |     const down = getDownloadButton(); | ||||||
|  |     const up = getUploadButton(); | ||||||
|  |     span.appendChild(down); | ||||||
|  |     span.appendChild(up); | ||||||
|  | 
 | ||||||
|  |     const next = target.nextElementSibling; | ||||||
|  |     console.log('inserting', span, 'before', next); | ||||||
|  |     target.style.display = 'none'; | ||||||
|  | 
 | ||||||
|  |     return target.parentElement.insertBefore(span, next); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   window.Game = window.Game || {}; | ||||||
|  | 
 | ||||||
|  |   window.Game.getData = getElements; | ||||||
|  |   window.Game.download = downloadData; | ||||||
|  | 
 | ||||||
|  |   window.addEventListener('load', () => console.log(addButtons())); | ||||||
|  | 
 | ||||||
|  | })(); | ||||||
|  |   | ||||||
							
								
								
									
										46
									
								
								old-reddit-expando.user.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								old-reddit-expando.user.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,46 @@ | ||||||
|  | // ==UserScript==
 | ||||||
|  | // @name Old Reddit Image Expander
 | ||||||
|  | // @namespace danielrayjones
 | ||||||
|  | // @description Allow removal of visited links on Amazon Giveaway Listing
 | ||||||
|  | // @include https://old.reddit.com*
 | ||||||
|  | // @version 1.0.3
 | ||||||
|  | // ==/UserScript==
 | ||||||
|  | 
 | ||||||
|  | (function() { | ||||||
|  |     const listing = document.getElementById('siteTable'); | ||||||
|  | 
 | ||||||
|  |     if (!listing) { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     let para = document.createElement('p'); | ||||||
|  |     let exButton = document.createElement('button'); | ||||||
|  |     exButton.innerText = 'Expand'; | ||||||
|  |     exButton = para.appendChild(exButton); | ||||||
|  |     exButton.addEventListener('click', () => document.querySelectorAll('.expando-button.collapsed').forEach(e => e.click())); | ||||||
|  | 
 | ||||||
|  |     let deButton = document.createElement('button'); | ||||||
|  |     deButton.innerText = 'Collapse'; | ||||||
|  |     deButton = para.appendChild(deButton); | ||||||
|  |     deButton.addEventListener('click', () => document.querySelectorAll('.expando-button.expanded').forEach(e => e.click())); | ||||||
|  | 
 | ||||||
|  |     para = listing.insertBefore(para, listing.firstChild); | ||||||
|  | 
 | ||||||
|  |     const proxyThumbClicks = function(evt) { | ||||||
|  |         let thing = evt.target; | ||||||
|  |         while (!thing.classList.contains('thing') && thing != document.body) { | ||||||
|  |             thing = thing.parentElement; | ||||||
|  |         } | ||||||
|  |         if (!thing.classList.contains('thing')) { | ||||||
|  |             console.log("Couldn't find thing"); | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |         evt.preventDefault(); | ||||||
|  | 
 | ||||||
|  |         thing.querySelector('.expando-button')?.click(); | ||||||
|  | 
 | ||||||
|  |         return false; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     listing.querySelectorAll('.thumbnail').forEach(e => e.addEventListener('click', proxyThumbClicks)); | ||||||
|  | })(); | ||||||
							
								
								
									
										89
									
								
								readcomiconline.user.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								readcomiconline.user.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,89 @@ | ||||||
|  | // -*- tab-width: 4; js-indent-level: 4; -*-
 | ||||||
|  | // ==UserScript==
 | ||||||
|  | // @name         Read Comic Online Scraper
 | ||||||
|  | // @namespace    danielrayjones
 | ||||||
|  | // @version      0.0.4
 | ||||||
|  | // @description  Scrape comics from readcomiconline.to
 | ||||||
|  | // @author       Dan Jones
 | ||||||
|  | // @match        https://readcomiconline.to/*
 | ||||||
|  | // @grant        none
 | ||||||
|  | // @require      https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
 | ||||||
|  | // @require      https://bowercdn.net/c/konami-code-1.3.2/src/jquery.konami.min.js
 | ||||||
|  | // @require      https://bowercdn.net/c/jszip-3.1.5/dist/jszip.min.js
 | ||||||
|  | // ==/UserScript==
 | ||||||
|  | 
 | ||||||
|  | /* global jQuery, JSZip */ | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
|  | (function($) { | ||||||
|  |     'use strict'; | ||||||
|  | 
 | ||||||
|  |     console.log('This does not work'); | ||||||
|  |     return; | ||||||
|  | 
 | ||||||
|  |     $(window).konami({ | ||||||
|  |         code: [71,69,84], | ||||||
|  |         cheat: getStuff | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     function getStuff() { | ||||||
|  |         let i = 0; | ||||||
|  | 
 | ||||||
|  |         let path = location.pathname.split('/'); | ||||||
|  |         let chapter = path.pop(); | ||||||
|  |         while (!chapter && path.length) { | ||||||
|  |             chapter = path.pop(); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         let match; | ||||||
|  |         if ((match = chapter.match(/^Issue-([0-9]+)/))) { | ||||||
|  |             chapter = match[1]; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         let name = path.pop(); | ||||||
|  | 
 | ||||||
|  |         if (path.pop() !== 'Comic') { | ||||||
|  |             alert('Not on a comic page'); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         console.log(`Getting ${name} ${chapter}`); | ||||||
|  | 
 | ||||||
|  |         let imgs = $('#divImage img').toArray(); | ||||||
|  |         console.log(imgs); | ||||||
|  | 
 | ||||||
|  |         let cbz = new JSZip(); | ||||||
|  | 
 | ||||||
|  |         function downloadCbz() { | ||||||
|  |             cbz.generateAsync({type: 'blob'}) | ||||||
|  |                 .then(blob => { | ||||||
|  |                     let title = name.replace(/-/g, ' ') + ' ' + chapter; | ||||||
|  | 
 | ||||||
|  |                     let $el = $('<a>'); | ||||||
|  |                     $(document.body).append($el); | ||||||
|  |                     $el.attr('href', URL.createObjectURL(blob)); | ||||||
|  |                     $el.attr('download', `${title} (readcomiconline) (Danjones).cbz`); | ||||||
|  |                     $el.get(0).click(); | ||||||
|  |                 }); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         function getOne() { | ||||||
|  |             if (!imgs || !imgs.length) { | ||||||
|  |                 downloadCbz(); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             let img = imgs.shift(); | ||||||
|  |             console.log(img.src); | ||||||
|  | 
 | ||||||
|  |             fetch(`//cors-anywhere.herokuapp.com/${img.src}`).then(resp => resp.blob()).then(blob => { | ||||||
|  |                 cbz.file(name + '-' + (i < 10 ? '00' : '0' ) + i + '.jpg', blob); | ||||||
|  | 
 | ||||||
|  |                 i = i+1; | ||||||
|  |                 setTimeout(getOne, 0); | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         getOne(); | ||||||
|  |     } | ||||||
|  | })(jQuery); | ||||||
							
								
								
									
										37
									
								
								trakt.clear-store.user.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								trakt.clear-store.user.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | ||||||
|  | // -*- tab-width: 4; js-indent-level: 4; -*-
 | ||||||
|  | // ==UserScript==
 | ||||||
|  | // @name         Trakt Storage Clearer
 | ||||||
|  | // @namespace    danielrayjones
 | ||||||
|  | // @version      0.0.1
 | ||||||
|  | // @description  
 | ||||||
|  | // @author       Dan Jones
 | ||||||
|  | // @match        https://trakt.tv/users/*/progress*
 | ||||||
|  | // @grant        none
 | ||||||
|  | // @require      https://bowercdn.net/c/konami-code-1.3.2/src/jquery.konami.min.js
 | ||||||
|  | // ==/UserScript==
 | ||||||
|  | 
 | ||||||
|  | /* global $, compressedCache, localStorage, MutationObserver */ | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
|  | (function() { | ||||||
|  |     'use strict'; | ||||||
|  | 
 | ||||||
|  |     const clearStorage = () => localStorage.clear(); | ||||||
|  | 
 | ||||||
|  |     /* todo | ||||||
|  |     $(window).konami({ | ||||||
|  |         code: [80, 73, 67, 75], | ||||||
|  |         cheat: clearStorage | ||||||
|  |     }); | ||||||
|  |     */ | ||||||
|  | 
 | ||||||
|  |     function addPickButton() { | ||||||
|  |         const $leftNav = $('.subnav-wrapper .container .left'); | ||||||
|  |         const $found = $leftNav.find('.clear-store'); | ||||||
|  |         if (!$found.length) { | ||||||
|  |             $leftNav.append('<span class="filter-dropdown toggle-simple-progress clear-store" title="Clear Storage"><span class="icon trakt-icon-cancel"></span>X</span>') | ||||||
|  |                 .find('.clear-store').on('click', clearStorage); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | })(); | ||||||
							
								
								
									
										111
									
								
								trakt.pick-show.user.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								trakt.pick-show.user.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,111 @@ | ||||||
|  | // -*- tab-width: 4; js-indent-level: 4; -*-
 | ||||||
|  | // ==UserScript==
 | ||||||
|  | // @name         Trakt Show Picker
 | ||||||
|  | // @namespace    danielrayjones
 | ||||||
|  | // @version      0.0.10
 | ||||||
|  | // @description  Pick a show from progress page
 | ||||||
|  | // @author       Dan Jones
 | ||||||
|  | // @match        https://trakt.tv/users/*/progress*
 | ||||||
|  | // @grant        none
 | ||||||
|  | // @require      https://bowercdn.net/c/konami-code-1.3.2/src/jquery.konami.min.js
 | ||||||
|  | // ==/UserScript==
 | ||||||
|  | 
 | ||||||
|  | /* global $, compressedCache, localStorage, MutationObserver */ | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
|  | (function() { | ||||||
|  |     'use strict'; | ||||||
|  | 
 | ||||||
|  |     let watched_shows; | ||||||
|  | 
 | ||||||
|  |     $(window).konami({ | ||||||
|  |         code: [80, 73, 67, 75], | ||||||
|  |         cheat: pickShow | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     function unghost() { | ||||||
|  |         $(this).removeClass('sortable-ghost'); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     function addPickButton() { | ||||||
|  |         const $leftNav = $('.subnav-wrapper .container .left'); | ||||||
|  |         const $found = $leftNav.find('.pick-episode'); | ||||||
|  |         if (!$found.length) { | ||||||
|  |             $leftNav.append('<span class="filter-dropdown toggle-simple-progress pick-episode" title="Pick Episode"><span class="icon trakt-icon-wand"></span></span>') | ||||||
|  |                 .find('.pick-episode').on('click', pickShow); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     function refreshPage() { | ||||||
|  |         addPickButton(); | ||||||
|  |         $('div[data-type="show"]') | ||||||
|  |             .on('click', unghost); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     refreshPage(); | ||||||
|  |     const observer = new MutationObserver(refreshPage); | ||||||
|  |     observer.observe(document.head.parentElement, {childList: true}); | ||||||
|  | 
 | ||||||
|  |     function getWeightedIndex(total) { | ||||||
|  |         const opts = []; | ||||||
|  |         for ( let idx = 0; idx < total; idx++) { | ||||||
|  |             for (let idxInst = 0; idxInst < total - idx; idxInst++) { | ||||||
|  |                 opts.push(idx); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         const totalWeights = opts.length; | ||||||
|  |         const which = Math.floor(Math.random() * totalWeights); | ||||||
|  | 
 | ||||||
|  |         return opts[which]; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     function pickShow() { | ||||||
|  | 
 | ||||||
|  |         if ('compressedCache' in window) { | ||||||
|  |             watched_shows = compressedCache.get('watched_shows'); | ||||||
|  |         } else { | ||||||
|  |             watched_shows = JSON.parse(localStorage.watched_shows); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         let $shows = $('div[data-type="show"]'); | ||||||
|  |         $shows.removeClass('sortable-ghost'); | ||||||
|  |         $shows = filterShows($shows); | ||||||
|  | 
 | ||||||
|  |         let picked = getWeightedIndex($shows.length); | ||||||
|  |         let $picked = $shows.eq(picked); | ||||||
|  | 
 | ||||||
|  |         $shows.addClass('sortable-ghost'); | ||||||
|  |         $picked.removeClass('sortable-ghost').insertAfter($picked.parent().find('.pagination-top')); | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     function filterShows($shows) { | ||||||
|  | 
 | ||||||
|  |         // Milliseconds in two days
 | ||||||
|  |         const twoDays = 2 * 24 * 60 * 60 * 1000; | ||||||
|  |         const twoDaysAgo = (new Date()) - twoDays; | ||||||
|  | 
 | ||||||
|  |         $shows.each(function (i, show) { | ||||||
|  | 
 | ||||||
|  |             const showId = Number.parseInt(show.dataset.showId); | ||||||
|  |             const showInfo = watched_shows[showId]; | ||||||
|  |             if (!showInfo) return; | ||||||
|  | 
 | ||||||
|  |             const lastWatch = showInfo.ts*1000; | ||||||
|  |             // Skip ones we've watched in the last two days
 | ||||||
|  |             if (lastWatch > twoDaysAgo) { | ||||||
|  |                 show.classList.add('sortable-ghost'); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             const percentage = show.dataset.percentage; | ||||||
|  | 
 | ||||||
|  |             if (percentage == 100) { | ||||||
|  |                 show.classList.add('sortable-ghost'); | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |         return $shows.filter(':not(.sortable-ghost)'); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | })(); | ||||||
|  | @ -2,28 +2,30 @@ | ||||||
| // ==UserScript==
 | // ==UserScript==
 | ||||||
| // @name         Trakt Scraper
 | // @name         Trakt Scraper
 | ||||||
| // @namespace    danielrayjones
 | // @namespace    danielrayjones
 | ||||||
| // @version      0.0.2
 | // @version      0.0.8
 | ||||||
| // @description  Scrape lists of shows/movies from Trakt and download a JSON file
 | // @description  Scrape lists of shows/movies from Trakt and download a JSON file
 | ||||||
| // @author       Dan Jones
 | // @author       Dan Jones
 | ||||||
| // @match        https://trakt.tv/*
 | // @match        https://trakt.tv/*
 | ||||||
| // @grant        none
 | // @grant        none
 | ||||||
| // @require      https://raw.githubusercontent.com/tommcfarlin/konami-code/master/src/jquery.konami.min.js
 | // @require      https://bowercdn.net/c/konami-code-1.3.2/src/jquery.konami.min.js
 | ||||||
| // ==/UserScript==
 | // ==/UserScript==
 | ||||||
| 
 | 
 | ||||||
|  | /* global $, compressedCache, localStorage */ | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
| (function() { | (function() { | ||||||
|     'use strict'; |     'use strict'; | ||||||
| 
 | 
 | ||||||
|     $(window).konami({ |     $(window).konami({ | ||||||
|         code: [71,69,84], |         code: [71,69,84], | ||||||
|         eventName: 'konami.get' |         cheat: getStuff | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     $(window).on('konami.get', getStuff); |  | ||||||
| 
 |  | ||||||
|     String.prototype.lpad = function(padString, length) { |     String.prototype.lpad = function(padString, length) { | ||||||
|         let str = this; |         let str = this; | ||||||
|         while (str.length < length) |         while (str.length < length) { | ||||||
|             str = padString + str; |             str = padString + str; | ||||||
|  |         } | ||||||
|         return str; |         return str; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  | @ -34,13 +36,14 @@ | ||||||
|         let $ep = $(that); |         let $ep = $(that); | ||||||
|         let $series = $ep.find('[itemtype="http://schema.org/TVSeries"]'); |         let $series = $ep.find('[itemtype="http://schema.org/TVSeries"]'); | ||||||
| 
 | 
 | ||||||
|  |         let this_ep = $ep.data(); | ||||||
|  | 
 | ||||||
|         if ($series.length < 1) { |         if ($series.length < 1) { | ||||||
|             $series = $('[itemtype="http://schema.org/TVSeries"]'); |             $series = $('[itemtype="http://schema.org/TVSeries"]'); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         let series = $ep.data('show-id'); |         let series = $ep.data('show-id'); | ||||||
|         let ep = $ep.data('episode-id'); |         let ep = $ep.data('episode-id'); | ||||||
|         //let url = $ep.data('url');
 |  | ||||||
|         let url = $ep.children('[itemprop="url"]').attr('content'); |         let url = $ep.children('[itemprop="url"]').attr('content'); | ||||||
| 
 | 
 | ||||||
|         let series_title = $series.children('[itemprop="name"]').attr('content'); |         let series_title = $series.children('[itemprop="name"]').attr('content'); | ||||||
|  | @ -50,41 +53,68 @@ | ||||||
|             $ep_title = $ep.find('[itemprop="name"]'); |             $ep_title = $ep.find('[itemprop="name"]'); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         let released = $ep.data('released') || null; | ||||||
|  |         if (released) { | ||||||
|  |             released = (new Date(released)).getTime()/1000; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         let ep_title = $ep_title.attr('content'); |         let ep_title = $ep_title.attr('content'); | ||||||
|         let ep_number = $ep.find('[itemprop="episodeNumber"]').attr('content'); |         let ep_number = $ep.find('[itemprop="episodeNumber"]').attr('content'); | ||||||
|         let season_number = $ep.data('season-number'); |         let season_number = $ep.data('season-number'); | ||||||
|         //let title = $ep.data('title');
 | 
 | ||||||
|         let title = series_title + " " + season_number + "x" + String(ep_number).lpad("0", 2) + ' "' + ep_title + '"'; |         if (!season_number) { | ||||||
|  |             let $title_ep = $ep.find('.main-title-sxe'); | ||||||
|  |             if ($title_ep.length && $title_ep.text()) { | ||||||
|  |                 let match = /([0-9+])x[0-9]+/.exec($title_ep.text()); | ||||||
|  |                 if (match) { | ||||||
|  |                     season_number = match[1]; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (!season_number) { | ||||||
|  |             season_number = 0; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         let title = series_title + " " + String(season_number) + "x" + String(ep_number).lpad("0", 2) + ' "' + ep_title + '"'; | ||||||
| 
 | 
 | ||||||
|         let watched = watched_shows[series] ? watched_shows[series].e[ep] : null; |         let watched = watched_shows[series] ? watched_shows[series].e[ep] : null; | ||||||
| 
 | 
 | ||||||
|         let this_ep = { |         let $img = $ep.find('[itemprop="image"]'); | ||||||
|             series_id: series, |         if ($img.length > 0) { | ||||||
|             episode_id: ep, |             this_ep['image'] = $img.attr('content'); | ||||||
|             title, |         } | ||||||
|             url, | 
 | ||||||
|             watches: watched ? watched[1] : 0, |         this_ep['series_id'] = series; | ||||||
|             last_watched: watched ? watched[0] : null, |         this_ep['episode_id'] = ep; | ||||||
|         }; |         this_ep['title'] = title; | ||||||
|  |         this_ep['url'] = url; | ||||||
|  |         this_ep['released'] = released; | ||||||
|  |         this_ep['watches'] = watched ? watched[1] : 0; | ||||||
|  |         this_ep['last_watched'] = watched ? watched[0] : null; | ||||||
| 
 | 
 | ||||||
|         return this_ep; |         return this_ep; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function processMovie(that) { |     function processMovie(that) { | ||||||
|         let $mov = $(that); |         let $mov = $(that); | ||||||
|  |         let this_mov = $mov.data(); | ||||||
|         let id = $mov.data('movie-id'); |         let id = $mov.data('movie-id'); | ||||||
| 
 | 
 | ||||||
|         let title = $mov.children('[itemprop="name"]').attr('content'); |         let title = $mov.children('[itemprop="name"]').attr('content'); | ||||||
|         let url = $mov.children('[itemprop="url"]').attr('content'); |         let url = $mov.children('[itemprop="url"]').attr('content'); | ||||||
|         let watched = watched_movies[id]; |         let watched = watched_movies[id]; | ||||||
| 
 | 
 | ||||||
|         let this_mov = { |         let $img = $mov.find('[itemprop="image"]'); | ||||||
|             id, |         if ($img.length > 0) { | ||||||
|             title, |             this_mov['image'] = $img.attr('content'); | ||||||
|             url, |         } | ||||||
|             watches: watched ? watched[1] : 0, | 
 | ||||||
|             last_watched: watched ? watched[0] : null, |         this_mov['id'] = id; | ||||||
|         }; |         this_mov['title'] = title; | ||||||
|  |         this_mov['url'] = url; | ||||||
|  |         this_mov['watches'] = watched ? watched[1] : 0; | ||||||
|  |         this_mov['last_watched'] = watched ? watched[0] : null; | ||||||
| 
 | 
 | ||||||
|         return this_mov; |         return this_mov; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -2,13 +2,15 @@ | ||||||
| // ==UserScript==
 | // ==UserScript==
 | ||||||
| // @name         Trakt Simplifier
 | // @name         Trakt Simplifier
 | ||||||
| // @namespace    danielrayjones
 | // @namespace    danielrayjones
 | ||||||
| // @version      0.0.2
 | // @version      0.0.3
 | ||||||
| // @description  Strip out eps/movies from trakt lists based on a query string
 | // @description  Strip out eps/movies from trakt lists based on a query string
 | ||||||
| // @author       Dan Jones
 | // @author       Dan Jones
 | ||||||
| // @match        https://trakt.tv/*
 | // @match        https://trakt.tv/*
 | ||||||
| // @grant        none
 | // @grant        none
 | ||||||
| // ==/UserScript==
 | // ==/UserScript==
 | ||||||
| 
 | 
 | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
| (function() { | (function() { | ||||||
|     'use strict'; |     'use strict'; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,27 +2,27 @@ | ||||||
| // ==UserScript==
 | // ==UserScript==
 | ||||||
| // @name         Viewcomic Scraper
 | // @name         Viewcomic Scraper
 | ||||||
| // @namespace    danielrayjones
 | // @namespace    danielrayjones
 | ||||||
| // @version      0.0.6
 | // @version      0.0.10
 | ||||||
| // @description  Scrape comics from viewcomic.com
 | // @description  Scrape comics from viewcomic.com
 | ||||||
| // @author       Dan Jones
 | // @author       Dan Jones
 | ||||||
| // @match        http://viewcomic.com/*
 | // @match        http://viewcomic.com/*
 | ||||||
| // @grant        none
 | // @grant        none
 | ||||||
| // @require      https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
 | // @require      https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
 | ||||||
| // @require      https://raw.githubusercontent.com/tommcfarlin/konami-code/master/src/jquery.konami.min.js
 | // @require      https://bowercdn.net/c/konami-code-1.3.2/src/jquery.konami.min.js
 | ||||||
|  | // @require      https://bowercdn.net/c/jszip-3.1.5/dist/jszip.min.js
 | ||||||
| // ==/UserScript==
 | // ==/UserScript==
 | ||||||
| 
 | 
 | ||||||
| /* global jQuery */ | /* global jQuery, JSZip */ | ||||||
|  | /* jshint esversion: 6 */ | ||||||
| 
 | 
 | ||||||
| (function($) { | (function($) { | ||||||
|     'use strict'; |     'use strict'; | ||||||
| 
 | 
 | ||||||
|     $(window).konami({ |     $(window).konami({ | ||||||
|         code: [71,69,84], |         code: [71,69,84], | ||||||
|         eventName: 'konami.get' |         cheat: getStuff | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     $(window).on('konami.get', getStuff); |  | ||||||
| 
 |  | ||||||
|     function getStuff() { |     function getStuff() { | ||||||
|         let i = 0; |         let i = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -36,23 +36,38 @@ | ||||||
|         let imgs = $('div.pinbin-copy img.picture, div.pinbin-copy img.hoverZoomLink').toArray(); |         let imgs = $('div.pinbin-copy img.picture, div.pinbin-copy img.hoverZoomLink').toArray(); | ||||||
|         console.log(imgs); |         console.log(imgs); | ||||||
| 
 | 
 | ||||||
|  |         let cbz = new JSZip(); | ||||||
|  | 
 | ||||||
|  |         function downloadCbz() { | ||||||
|  |             cbz.generateAsync({type: 'blob'}) | ||||||
|  |                 .then(blob => { | ||||||
|  |                     let title = name.replace(/-/g, ' ').replace(/\b([0-9]{4})\b/, '($1)'); | ||||||
|  | 
 | ||||||
|  |                     let $el = $('<a>'); | ||||||
|  |                     $(document.body).append($el); | ||||||
|  |                     $el.attr('href', URL.createObjectURL(blob)); | ||||||
|  |                     $el.attr('download', `${title} (viewcomic) (Danjones).cbz`); | ||||||
|  |                     $el.get(0).click(); | ||||||
|  |                 }); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         function getOne() { |         function getOne() { | ||||||
|             if (!imgs) return; |             if (!imgs || !imgs.length) { | ||||||
|  |                 downloadCbz(); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             let img = imgs.shift(); |             let img = imgs.shift(); | ||||||
|             console.log(img.src); |             console.log(img.src); | ||||||
| 
 | 
 | ||||||
|             fetch(img.src).then(resp => resp.blob()).then(blob => { |             fetch(img.src).then(resp => resp.blob()).then(blob => { | ||||||
|                 let $el = $('<a>'); |                 cbz.file(name + '-' + (i < 10 ? '00' : '0' ) + i + '.jpg', blob); | ||||||
|                 $(document.body).append($el); |  | ||||||
|                 $el.attr('href', URL.createObjectURL(blob)); |  | ||||||
|                 $el.attr('download', name + '-' + (i < 10 ? '00' : '0' ) + i + '.jpg'); |  | ||||||
|                 $el.get(0).click(); |  | ||||||
| 
 | 
 | ||||||
|                 i = i+1; |                 i = i+1; | ||||||
|                 setTimeout(getOne, 1000); |                 setTimeout(getOne, 0); | ||||||
|             }); |             }); | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|         getOne(); |         getOne(); | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
| })(jQuery); | })(jQuery); | ||||||
|  |  | ||||||
							
								
								
									
										67
									
								
								wheniwork.hours.user.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								wheniwork.hours.user.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,67 @@ | ||||||
|  | // -*- tab-width: 4; js-indent-level: 4; -*-
 | ||||||
|  | // ==UserScript==
 | ||||||
|  | // @name WhenIWork True Total Worked
 | ||||||
|  | // @namespace danielrayjones
 | ||||||
|  | // @description Adds the Total hours worked, including today
 | ||||||
|  | // @include https://app.wheniwork.com/payroll/
 | ||||||
|  | // @version 0.2.1
 | ||||||
|  | // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
 | ||||||
|  | // ==/UserScript==
 | ||||||
|  | 
 | ||||||
|  | /* global $ */ | ||||||
|  | /* jshint esversion: 6 */ | ||||||
|  | 
 | ||||||
|  | $(document).ready(function() { | ||||||
|  |   'use strict'; | ||||||
|  | 
 | ||||||
|  |   // Filter out this event from iframes
 | ||||||
|  |   if (!this.body.classList.contains("controller-payroll")) { | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   let currentHourSum = 0; | ||||||
|  | 
 | ||||||
|  |   function updateHours(hours) { | ||||||
|  |     currentHourSum = hours; | ||||||
|  | 
 | ||||||
|  |     let weekPlusDayTotal = $('#week-plus-day-total'); | ||||||
|  |     let span = `<span class="hour-type-label">Total with Today</span>${hours}`; | ||||||
|  | 
 | ||||||
|  |     if (weekPlusDayTotal.length === 0) { | ||||||
|  |       $('#header-summary-container .stats').append( | ||||||
|  |         `<div class="hour-type-summary"><div id="week-plus-day-total" class="hour-type-total difference">${span}</div></div>` | ||||||
|  |       ); | ||||||
|  |     } else { | ||||||
|  |       weekPlusDayTotal.html(span); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     // In case this ran while the page was loading, let's try again in two seconds.
 | ||||||
|  |     return setTimeout(addHours, 2000); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   function addHours() { | ||||||
|  |     let hourSum = 0; | ||||||
|  |     $('.times-list .col-worked .text-input[data-total]').each(function () { | ||||||
|  |       hourSum += parseFloat($(this).text()) || 0; | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     // Adjust for floating point errors
 | ||||||
|  |     hourSum = Math.round(hourSum*100)/100; | ||||||
|  | 
 | ||||||
|  |     console.log(`got ${hourSum} hours`); | ||||||
|  | 
 | ||||||
|  |     // AJAX request hasn't finished yet. Let's wait some more.
 | ||||||
|  |     if (currentHourSum === 0 && hourSum === 0) return setTimeout(addHours, 2000); | ||||||
|  | 
 | ||||||
|  |     if (currentHourSum !== hourSum && hourSum > 0) { | ||||||
|  |       return updateHours(hourSum); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return null; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // The hours don't show up until after an AJAX request completes.
 | ||||||
|  |   // Let's wait two seconds for it to finish.
 | ||||||
|  |   setTimeout(addHours, 2000); | ||||||
|  | 
 | ||||||
|  | }); | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue