User:Troylaurin
Jump to navigation
Jump to search
I like scripting!
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);
});
})();
|
Factory scripts: https://www.perfecttower2.com/wiki/AI_Craftapalooza
# | # | # | # | # | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | gems | 21 | white pyramid | 41 | 61 | memory outline | 81 | star | 101 | grey module | ||||||
2 | hypercube | 22 | tree logo | 42 | 62 | memory | 102 | right click | ||||||||
3 | cogs | 23 | white infinity | 43 | white pencil | 63 | cpu outline | 103 | world | |||||||
4 | white xp | 24 | hourglass | 44 | space bar | 64 | cpu | 104 | white warning | |||||||
5 | exotic gems | 25 | unlock | 45 | white 6-pt star | 65 | server | 105 | grid mode | |||||||
6 | white help | 26 | white convert shard | 46 | white plus | 66 | graph / statistics | 106 | list mode | |||||||
7 | blue module | 27 | white mine nothing | 47 | white blurry circle | 67 | blue shield | 107 | save icon | |||||||
8 | white circle | 28 | white shard per time | 48 | to craft grid | 68 | grey shield | |||||||||
9 | white cube | 29 | white redo arrow | 49 | from craft grid | 69 | drill | |||||||||
10 | white target | 30 | 50 | cloud | 70 | trashcan | ||||||||||
11 | Dr Cubos | 31 | 51 | yellow module | 71 | |||||||||||
12 | white tick | 32 | 52 | red module | 72 | |||||||||||
13 | lock | 33 | 53 | purple module | 73 | |||||||||||
14 | white shard | 34 | 54 | bomb | 74 | 94 | checkbox | |||||||||
15 | white skull | 35 | 55 | flag / impulse | 75 | 95 | red gem?! | |||||||||
16 | white square | 36 | 56 | equals / condition | 76 | fuel can | ||||||||||
17 | white cross | 37 | white arrow right | 57 | function / action | 77 | 97 | museum stones | ||||||||
18 | health logo | 38 | firesword logo | 58 | left click | 78 | 98 | white stairs | ||||||||
19 | damage logo | 39 | kreds | 59 | ship | 79 | 99 | shipping box | ||||||||
20 | wave logo | 40 | 60 | circle/orb | 80 | 100 | save icon |