/
plugextra.js
141 lines (127 loc) · 3.76 KB
/
plugextra.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// PlugExtra by Jonas "TeeheeKeiken" Tödter is licensed under a Creative Commons
// Attribution-NonCommercial-NoDerivs 3.0 Unported License.
// http://creativecommons.org/licenses/by-nc-nd/3.0/
//
// When sharing PlugExtra the official PlugExtra website has to be mentioned.
// http://teeheelp.github.io/PlugExtra/
//
// Author: Jonas "TeeheeKeiken" Tödter
function startBot()
{
var scr = document.createElement("script");
scr.id = "plugextra";
scr.src = ('https://raw.github.com/TeeheeLP/PlugExtra/dev/plugextra-x.js');
document.body.appendChild(scr);
}
var isclicked = false;
var dodrag = false;
var doresize = false;
var oldcx;
var oldcy;
function dragLog(e)
{
var log = document.getElementById("log");
if (isclicked && e.button == 0)
{
if (e.pageX < (parseInt(getComputedStyle(log).marginLeft) + parseInt(log.style.width)
- parseInt(log.style.right) * ($.browser.webkit ? 1 : -1) - 20))
{
if (e.pageY < parseInt(log.style.top) + 10)
{
dodrag = true;
}
if (e.pageY > parseInt(log.style.top) + parseInt(log.style.height) - 10) doresize = true;
}
else isclicked = false;
}
if (dodrag || doresize)
{
document.getSelection().removeAllRanges();
if ($.browser.webkit) document.getSelection().empty();
if (oldcx == "" || oldcx == null)
{
oldcx = e.pageX;
oldcy = e.pageY;
}
}
if (dodrag)
{
var movex = e.pageX - oldcx;
var movey = e.pageY - oldcy;
oldcx = e.pageX;
oldcy = e.pageY;
log.style.right = (parseFloat(log.style.right) - movex) + "px";
log.style.top = (parseFloat(log.style.top) + movey) + "px";
}
if (doresize)
{
log.style.transition = "";
log.style.webkitTransition = "";
var movex = e.pageX - oldcx;
var movey = e.pageY - oldcy;
oldcx = e.pageX;
oldcy = e.pageY;
if (parseFloat(log.style.width) > 93 || movex > 0)
{
log.style.width = (parseFloat(log.style.width) + movex * 2) + "px";
}
else log.style.width = "93px";
if (parseFloat(log.style.height) > 50 || movey > 0)
{
log.style.height = (parseFloat(log.style.height) + movey) + "px";
}
else log.style.height = "50px";
}
}
function resetLayout()
{
var log = document.getElementById("log");
log.style.top = "288px";
log.style.right = "177px";
log.style.width = "837px";
log.style.height = "271px";
}
function stopDrag()
{
if (isclicked || dodrag || doresize)
{
isclicked = false;
dodrag = false;
doresize = false;
oldcx = '';
oldcy = '';
var log = document.getElementById("log");
log.style.transition = "background 0.5s, opacity 0.5s, height 0.5s";
log.style.webkitTransition = "background 0.5s, opacity 0.5s, height 0.5s";
}
}
var elem = document.createElement("div");
elem.id = "log";
elem.style.color = "lightgray";
elem.style.position = "relative";
elem.style.top = "288px";
elem.style.display = "block";
elem.style.zIndex = "15";
elem.style.textShadow ="0px 0px 2px black";
elem.style.height = "271px";
elem.style.width = "837px";
elem.style.overflowY = "scroll";
elem.style.margin = "auto";
elem.style.borderTop = "5px solid #333333";
elem.style.borderBottom = "5px solid #333333";
elem.style.padding = "5px";
elem.style.backgroundColor = "#050505";
elem.style.opacity = "0.8";
//elem.style.boxShadow = "1px 1px 2px 1px #444444 inset";
elem.style.transition = "background 0.5s, opacity 0.5s, height 0.5s";
elem.style.webkitTransition = "background 0.5s, opacity 0.5s, height 0.5s";
elem.style.right = "177px";
//elem.style.resize = "both";
elem.setAttribute("onmousedown", "isclicked = true;");
elem.setAttribute("ondblclick", "resetLayout();");
//elem.setAttribute("onmousemove", "dragLog(event);");
//elem.setAttribute("onmouseup", "stopDrag();");
document.body.appendChild(elem);
$(document).mousemove(function(event) { dragLog(event); });
$(document).mouseup(function() { stopDrag(); });
setTimeout(function(){startBot()}, 0);