Difference between revisions of "User:Troylaurin"
Jump to navigation
Jump to search
Troylaurin (talk | contribs) (All parts) |
Troylaurin (talk | contribs) |
||
Line 1: | Line 1: | ||
A bunch of scripts to craft stuff. | A bunch of scripts to craft stuff. | ||
+ | {| class="wikitable mw-collapsible mw-collapsed" | ||
+ | !Click to copy tamperscript | ||
+ | |- | ||
+ | |<syntaxhighlight lang="javascript"> | ||
+ | // ==UserScript== | ||
+ | // @name Click to copy on <pre> tags | ||
+ | // @namespace http://tampermonkey.net/ | ||
+ | // @version 0.1 | ||
+ | // @description Add click to copy buttons to <pre> tags | ||
+ | // @author Troy.Laurin@gmail.com | ||
+ | // @match https://www.perfecttower2.com/wiki/* | ||
+ | // @grant GM_addStyle | ||
+ | // @require https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js | ||
+ | // @require http://code.jquery.com/jquery-3.5.1.slim.min.js | ||
+ | // ==/UserScript== | ||
+ | |||
+ | (function() { | ||
+ | 'use strict'; | ||
+ | |||
+ | // ------------------------------------------ | ||
+ | // CSS part injected in the page | ||
+ | GM_addStyle(" \ | ||
+ | .precontainer { \ | ||
+ | position: relative; \ | ||
+ | } \ | ||
+ | .copy-btn { \ | ||
+ | background: #DDD; \ | ||
+ | font-family: monospace; \ | ||
+ | font-weight: bolder; \ | ||
+ | margin: 0; \ | ||
+ | opacity: 0; \ | ||
+ | padding: 4px; \ | ||
+ | position: absolute; \ | ||
+ | right: 1px; \ | ||
+ | top: 1px; \ | ||
+ | cursor: pointer; \ | ||
+ | -webkit-transition: opacity 0.3s ease-in-out; \ | ||
+ | -o-transition: opacity 0.3s ease-in-out; \ | ||
+ | transition: opacity 0.3s ease-in-out; \ | ||
+ | } \ | ||
+ | .precontainer:hover >.copy-btn { \ | ||
+ | opacity: 1; \ | ||
+ | } \ | ||
+ | table { width: 100% } \ | ||
+ | "); | ||
+ | |||
+ | $('pre').wrap('<div class="precontainer"></div>'); | ||
+ | $('pre').before($('<span class="copy-btn"></></span>')); | ||
+ | |||
+ | new ClipboardJS('.copy-btn', { | ||
+ | text: function(trigger) { | ||
+ | return $(trigger.nextElementSibling).text(); | ||
+ | } | ||
+ | }) | ||
+ | .on('success',function (e) { | ||
+ | $(e.trigger).html("<copied/>") | ||
+ | setTimeout(function() { | ||
+ | $(e.trigger).html("</>"); | ||
+ | }, 3000); | ||
+ | }) | ||
+ | .on('error',function (e) { | ||
+ | $(e.trigger).html("Error!") | ||
+ | setTimeout(function() { | ||
+ | $(e.trigger).html("</>"); | ||
+ | }, 3000); | ||
+ | }); | ||
+ | })(); | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |} | ||
Revision as of 08:06, 16 January 2021
A bunch of scripts to craft stuff.
Click to copy tamperscript |
---|
// ==UserScript==
// @name Click to copy on <pre> tags
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add click to copy buttons to <pre> tags
// @author Troy.Laurin@gmail.com
// @match https://www.perfecttower2.com/wiki/*
// @grant GM_addStyle
// @require https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js
// @require http://code.jquery.com/jquery-3.5.1.slim.min.js
// ==/UserScript==
(function() {
'use strict';
// ------------------------------------------
// CSS part injected in the page
GM_addStyle(" \
.precontainer { \
position: relative; \
} \
.copy-btn { \
background: #DDD; \
font-family: monospace; \
font-weight: bolder; \
margin: 0; \
opacity: 0; \
padding: 4px; \
position: absolute; \
right: 1px; \
top: 1px; \
cursor: pointer; \
-webkit-transition: opacity 0.3s ease-in-out; \
-o-transition: opacity 0.3s ease-in-out; \
transition: opacity 0.3s ease-in-out; \
} \
.precontainer:hover >.copy-btn { \
opacity: 1; \
} \
table { width: 100% } \
");
$('pre').wrap('<div class="precontainer"></div>');
$('pre').before($('<span class="copy-btn"></></span>'));
new ClipboardJS('.copy-btn', {
text: function(trigger) {
return $(trigger.nextElementSibling).text();
}
})
.on('success',function (e) {
$(e.trigger).html("<copied/>")
setTimeout(function() {
$(e.trigger).html("</>");
}, 3000);
})
.on('error',function (e) {
$(e.trigger).html("Error!")
setTimeout(function() {
$(e.trigger).html("</>");
}, 3000);
});
})();
|
IN DEVELOPMENT. USE AT YOUR OWN RISK.
General scripts
Script | Info | Source | |||
---|---|---|---|---|---|
craft init | 1 impulse
no conditions 9 actions |
| |||
craft GO | 1 impulse
1 condition
12 actions |
| |||
craft tier up | 1 impulse
1 condition
1 action |
| |||
craft mode up | 1 impulse
1 condition
2 actions |
| |||
craft output up | 1 impulse
1 condition
2 actions |
| |||
craft count up | 1 impulse
1 condition
5 actions |
| |||
craft count down | 1 impulse
1 condition
5 actions |
| |||
craft inventory use | 1 impulse
1 condition
1 action |
| |||
craft script check | 3 actions |
| |||
craft producer set (pg1) | 1 impulse
1 condition
14 actions |
| |||
craft producer set (pg2) | 1 impulse
1 condition
13 actions |
| |||
craft machine set | 1 impulse
1 condition
4 actions |
| |||
craft ingot | 15 actions |
|
Parts scripts
Output | Part | Scripts | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | chips |
| |||||||||||||||||||||||||||
2 | plates |
| |||||||||||||||||||||||||||
3 | dense plates |
| |||||||||||||||||||||||||||
4 | blocks |
| |||||||||||||||||||||||||||
5 | cables |
| |||||||||||||||||||||||||||
6 | insulated cables |
| |||||||||||||||||||||||||||
7 | rods |
| |||||||||||||||||||||||||||
8 | motors |
| |||||||||||||||||||||||||||
9 | pumps |
|
Producer scripts
Machine scripts
Name | Lines | Code | |||
---|---|---|---|---|---|
x | x |
|