Skip to content

Commit

Permalink
refreshed readme, added more scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
k3rielit committed May 29, 2022
1 parent f7ff9ce commit 4089b65
Show file tree
Hide file tree
Showing 8 changed files with 440 additions and 14 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Scripts
funny userscript collection to confuse chrome
## Quick installs:
* antileet
* [soft](https://github.com/k3rielit/scripts/raw/main/antileet/hard.user.js)
* [hard](https://github.com/k3rielit/scripts/raw/main/antileet/soft.user.js)
* [sziauram](https://github.com/k3rielit/scripts/raw/main/antileet/sziauram.user.js)
* Flippity
* [normal](https://github.com/k3rielit/scripts/raw/main/flippity/flippity-tamperm.user.js)
* [funny](https://github.com/k3rielit/scripts/raw/main/flippity/ultimity-tamperm.user.js)
* NR Addons [livemap](https://github.com/k3rielit/scripts/raw/main/nr_addons/nr_livemap.user.js)
* Oktatas.hu [normal](https://github.com/k3rielit/scripts/raw/main/oktatas_hu/oktatas_hu.user.js)
* Wizer.me [normal](https://github.com/k3rielit/scripts/raw/main/wizerme/wizerme.user.js)
Some funny userscripts to confuse chrome.

Details about each script can be found inside their directory.

| Directory | Install |
|--------------------------------|---------|
| [antileet](/antileet/) | [[soft](https://github.com/k3rielit/scripts/raw/main/antileet/hard.user.js)] [[hard](https://github.com/k3rielit/scripts/raw/main/antileet/soft.user.js)] [[sziauram](https://github.com/k3rielit/scripts/raw/main/antileet/sziauram.user.js)] |
| [dotnetfiddle](/dotnetfiddle/) | [[downloader](https://github.com/k3rielit/scripts/raw/main/dotnetfiddle/dotnetfiddle_dl.user.js)] |
| [flippity](/flippity/) | [[solver](https://github.com/k3rielit/scripts/raw/main/flippity/flippity-tamperm.user.js)] [[advanced](https://github.com/k3rielit/scripts/raw/main/flippity/ultimity-tamperm.user.js)] |
| [nr_addons](/nr_addons/) | [[livemap](https://github.com/k3rielit/scripts/raw/main/nr_addons/nr_livemap.user.js)] |
| [oktatas_hu](/oktatas_hu/) | [[splitscreen](https://github.com/k3rielit/scripts/raw/main/oktatas_hu/oktatas_hu.user.js)] |
| [steamcharts](/steamcharts/) | [[extended](https://github.com/k3rielit/scripts/raw/main/steamcharts/extendedsteamcharts.user.js)] |
| [vectors](/vectors/) | [[previews](https://github.com/k3rielit/scripts/raw/main/vectors/vectorpreviews.user.js)] |
| [wizerme](/wizerme/) | [[solver](https://github.com/k3rielit/scripts/raw/main/wizerme/wizerme.user.js)] |
| [youtube](/youtube/) | [[normalize-links](https://github.com/k3rielit/scripts/raw/main/youtube/normalize-links.user.js)] |
10 changes: 10 additions & 0 deletions dotnetfiddle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# DotNetFiddle
Adds a download button into the navbar for [dotnetfiddle](https://dotnetfiddle.net/) projects, next to `Save` on the left. Should work with every type of project, 1 file for each code window.

**Filename(s)**: `<Type>_<Name>.cs`
- Type: `Console` / `Controller` / `View` / `Model` / etc
- Name: The content of the textbox above the code, or `Program` if that's empty.

### Install:
1. Install the Tampermonkey extension. ([Link](https://www.tampermonkey.net))
2. [Install](https://github.com/k3rielit/scripts/raw/main/dotnetfiddle/dotnetfiddle_dl.user.js) the script.
74 changes: 74 additions & 0 deletions dotnetfiddle/dotnetfiddle_dl.user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// ==UserScript==
// @name DotNetFiddle Downloader
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Adds a Download button to the top to save the code faster.
// @author k3rielit
// @match https://dotnetfiddle.net/
// @icon https://www.google.com/s2/favicons?domain=dotnetfiddle.net
// @grant none
// @downloadURL https://github.com/k3rielit/scripts/raw/main/dotnetfiddle/dotnetfiddle_dl.user.js
// ==/UserScript==

(function() {
'use strict';
// file download function: https://stackoverflow.com/questions/3665115/how-to-create-a-file-in-memory-for-user-to-download-but-not-through-server
let saveFile = function(filename, content) {
const blob = new Blob([content], {type: 'text'});
if(window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(blob, filename);
}
else{
const elem = window.document.createElement('a');
elem.style.display = "none";
elem.href = window.URL.createObjectURL(blob, { oneTimeOnly: true });
elem.download = filename;
document.body.appendChild(elem);
elem.click();
document.body.removeChild(elem);
}
}
// create the download button
let dl = document.createElement('button');
dl.className = 'btn btn-default';
dl.innerHTML = `<span class="glyphicon glyphicon glyphicon-download-alt"></span>`;
dl.onclick = function() {
// get the file's name from the text input on the page
let filename = (document.querySelector("#CodeForm > div.main.docked > div.status-line > div.name-container > input[type=text]").value || 'Program')+'.cs';
// try getCodeBlocks(): https://stackoverflow.com/questions/7306669/how-to-get-all-properties-values-of-a-javascript-object-without-knowing-the-key
if(fiddle && fiddle.getCodeBlocks) {
let cobj = fiddle.getCodeBlocks();
for (let ckey in cobj) {
if (Object.prototype.hasOwnProperty.call(cobj, ckey)) {
saveFile(ckey+'_'+filename,cobj[ckey]);
}
}
}
// or getEditors(): https://stackoverflow.com/questions/7306669/how-to-get-all-properties-values-of-a-javascript-object-without-knowing-the-key
else if(fiddle && fiddle.getEditors) {
let eobj = fiddle.getEditors();
for (let ekey in eobj) {
if (Object.prototype.hasOwnProperty.call(eobj, ekey)) {
saveFile(ekey+'_'+filename,eobj[ekey].options.value);
}
}
}
// or just get it from the page (there's a chance that the editor will remove the invisible part of the code even when scrolling)
else {
let index = 0;
[...document.querySelectorAll('.CodeMirror-scroll')].map(m => {
let originalScroll = m.scrollTop+0;
m.scrollTop = Number.MAX_SAFE_INTEGER;
// wait for the scroll to take effect, then revert (to force loading all of the code lines)
setTimeout(() => {
m.scrollTop = originalScroll;
let content = [...[...document.querySelectorAll('div.CodeMirror-code')][index].cloneNode(true).querySelectorAll('.CodeMirror-line')].map(l => l.innerText).join('\n');
saveFile((index+1)+"_"+filename,content);
index++;
});
});
}
};
// append the download button
document.querySelector('#top-navbar > div.navbar-center-container > div.navbar-center-container > div:nth-child(1)').appendChild(dl);
})();
4 changes: 2 additions & 2 deletions oktatas_hu/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Oktatás.hu
## Oktatas.hu
Az oktatas.hu-s pdf oldalakra 2 gombot rak, Az egyik megnyitja új lapon a feladat megoldókulcs párját, a másik fél képernyőre rakja.

**Telepítés**:
1. Tampermonkey bővítmény telepítése. ([Link](https://www.tampermonkey.net))
2. [telepítés](https://github.com/k3rielit/scripts/raw/main/oktatas_hu/oktatas_hu.user.js)
2. Script [Telepítés](https://github.com/k3rielit/scripts/raw/main/oktatas_hu/oktatas_hu.user.js)
20 changes: 20 additions & 0 deletions steamcharts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Steam Charts
Some extra features for [steamcharts](https://steamcharts.com) ([example](https://steamcharts.com/app/218620)).

### Features:
- **JSON data** `top right`
- Open in New Tab
- Download Original
- Download Processed
- Log to Console
- **Steam** `top right`
- Play
- Install
- Store Page
- Community Hub
- **Details** `middle`
- Table with the full data (similar to the chart)

### Install:
1. Install the Tampermonkey extension. ([Link](https://www.tampermonkey.net))
2. [Install](https://github.com/k3rielit/scripts/raw/main/steamcharts/extendedsteamcharts.user.js) the script.
197 changes: 197 additions & 0 deletions steamcharts/extendedsteamcharts.user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
// ==UserScript==
// @name ExtendedSteamCharts
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Add more features to steamcharts.
// @author k3rielit
// @match *://*.steamcharts.com/app/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=steamcharts.com
// @grant none
// @downloadURL https://github.com/k3rielit/scripts/raw/main/steamcharts/extendedsteamcharts.user.js
// ==/UserScript==

(function() {
'use strict';
const toInt = function(text) {
let result = parseInt(text ?? '0');
return isNaN(result) ? 0 : result;
};
const toFloat = function(text) {
let result = parseFloat(text ?? '0');
return isNaN(result) ? 0 : result;
};
const saveFile = function(filename, content) {
const blob = new Blob([content], {type: 'text'});
if(window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(blob, filename);
}
else{
const elem = window.document.createElement('a');
elem.style.display = "none";
elem.href = window.URL.createObjectURL(blob, { oneTimeOnly: true });
elem.download = filename;
document.body.appendChild(elem);
elem.click();
document.body.removeChild(elem);
}
}
const decideGain = function(current,previous) {
if(current==previous) {return '';}
else {return current>previous ? 'gain' : 'loss';}
}
const filepath = location.origin+location.pathname+'/chart-data.json';
const steamid = toInt(location.pathname.split('/')[2]);
const gametitle = document.querySelector('#app-title > a').innerText;
const currentIsoTime = new Date().toISOString();
// CSS
let style = document.createElement('style');
style.innerText = `
.collapsible {
background-color: #1a1a1a;
color: white;
cursor: pointer;
padding: 14px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.active, .collapsible:hover {
background-color: #222222;
}
.collapsible:after {
content: '+';
color: white;
font-weight: bold;
float: right;
margin-left: 5px;
}
.active:after {
content: "-";
}
.collapsible-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
background-color: #1a1a1a;
margin-bottom: 20px;
padding: 0 14px;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
right: 0;
background-color: #1a1a1a;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
white-space: nowrap;
width: fit-content;
text-align: left;
}
.dropdown-content a {
padding: 6px 10px 6px 10px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #222222;}
.dropdown:hover .dropdown-content {display: block;}
`;
document.head.appendChild(style);
// HTML
document.querySelector('#app-links').innerHTML = `
<div class="dropdown">
<a href="#" class="dropbtn">JSON Data</a>
<div class="dropdown-content" style="left:0;">
<a id="json-nt" href="javascript:;" target="_blank">Open in New Tab</a>
<a id="json-do" href="javascript:;">Download Original</a>
<a id="json-dp" href="javascript:;">Download Processed</a>
<a id="json-lc" href="javascript:;">Log to Console</a>
</div>
</div>
<span> | </span>
<div class="dropdown">
<a href="#" class="dropbtn">Steam</a>
<div class="dropdown-content">
<a href="steam://run/${steamid}" target="_blank">Play</a>
<a href="steam://install/${steamid}" target="_blank">Install</a>
<a href="http://store.steampowered.com/app/${steamid}/" target="_blank">Store Page</a>
<a href="http://steamcommunity.com/app/${steamid}" target="_blank">Community Hub</a>
</div>
</div>
`;
// JS
document.querySelector('#json-nt').href = filepath;
fetch(filepath).then(raw => raw.json()).then(data => {
let processedData = {
name: gametitle,
steamid: steamid,
time: currentIsoTime,
summary: [...document.querySelectorAll('.common-table > tbody > tr')].map(row => {
let content = row.innerText.split('\t');
return {
period: content[0],
averagePlayers: toFloat(content[1].replaceAll(',','')),
gain: toFloat(content[2].replaceAll(',','')),
gainPercent: toFloat(content[3].replaceAll(',','').replaceAll('%','')),
peakPlayers: toFloat(content[4].replaceAll(',','')),
};
}),
data: structuredClone(data).map((m,i) => {
return {
ticks: m[0],
time: new Date(m[0]).toISOString(),
players: m[1],
}
}),
};
document.querySelector('#json-do').addEventListener('click',() => {
saveFile(`steamcharts-${(steamid > 0 ? steamid : 'data')}-${currentIsoTime}.original.json`,JSON.stringify(data,null,4));
},false);
document.querySelector('#json-dp').addEventListener('click',() => {
saveFile(`steamcharts-${(steamid > 0 ? steamid : 'data')}-${currentIsoTime}.processed.json`,JSON.stringify(processedData,null,4));
},false);
document.querySelector('#json-lc').addEventListener('click',() => {
console.log({original:data, processed:processedData});
},false);
// details table
let collapsible = document.createElement('div');
collapsible.id = 'app-details';
collapsible.innerHTML = `
<button id="details-toggle" class="collapsible" onclick="this.classList.toggle('active'); this.nextElementSibling.style.maxHeight = this.nextElementSibling.style.maxHeight ? null : this.nextElementSibling.scrollHeight + 'px';">Details</button>
<div class="collapsible-content" id="details-container">
<table style="width: 100%; border-collapse: collapse;">
<thead>
<tr>
<th></th>
<th class="center">Time</th>
<th class="right">Players</th>
</tr>
</thead>
<tbody>${data.reverse().map((md,i) =>
`<tr ${i%2==1?'':'class="odd"'}>
<td class="left num">#${i+1}</td>
<td class="center num">${new Date(md[0]).toISOString()}</td>
<td class="right num ${decideGain( md[1], (data[i+1]??[0,0])[1] )}">${md[1]}</td>
</tr>`).join('\n')}
</tbody>
</table>
</div>
`;
document.querySelector('#content-wrapper').insertBefore(collapsible,document.querySelector('#app-hours-content'));
});
document.querySelector('#app-title > a').innerHTML = `<a href="https://steamdb.info/app/${steamid}/" target="_blank">${gametitle}</a>`;
})();
5 changes: 5 additions & 0 deletions vectors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Vectors
Some extra features for the [vector-templates](https://www.vector-templates.com) ([example](https://www.vector-templates.com/templates/show/hongqi_e-hs9/21749/)) and [the-blueprints](https://www.the-blueprints.com) ([example](https://www.the-blueprints.com/vectordrawings/show/21749/hongqi_e-hs9/)) preview pages.
### Install:
1. Install the Tampermonkey extension. ([Link](https://www.tampermonkey.net))
2. [Install](https://github.com/k3rielit/scripts/raw/main/vectors/vectorpreviews.user.js) the script.
Loading

0 comments on commit 4089b65

Please sign in to comment.