-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcstw.js
54 lines (52 loc) · 2.62 KB
/
cstw.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
//
// This is stress CSS widget, a tool that helps to detect css perfromance issuess.
//
// This widget is based on the Stress CSS tool authored by Andy Edinborough.
//
(function(d, $, op) {
var op = $.extend({text: 'STRESS CSS',
stress_script: 'http://andy.edinborough.org/demos/css-stress/stressTest.js',
}, op)
, wid_cnt = $('<div id="wid_cnt" />')
.css(op.cnt_style || {'cursor': 'pointer',
'z-index': '16776274',
'position': 'fixed',
'white-space': 'nowrap',
'top': '50%',
'right': '0',
'width': '30px',
'padding': '0',
'margin': '0',
'-webkit-transform': 'rotate(-90deg)',
'-moz-transform': 'rotate(-90deg)',
'-ms-transform': 'rotate(-90deg)',
'-o-transform': 'rotate(-90deg)',
'transform': 'rotate(-90deg)',
'-webkit-transform-origin': '50% 50%',
'-moz-transform-origin': '50% 50%',
'-ms-transform-origin': '50% 50%',
'-o-transform-origin': '50% 50%',
'transform-origin': '50% 50%',
'filter': 'progid:DXImageTransform.Microsoft.BasicImage(rotation=3)'})
.click(function(e) {
var s = d.createElement('script'),
doit = function () {
if (window.stressTest) {
stressTest.bookmarklet();
} else {
setTimeout(doit, 100);
}
};
s.src = op.stress_script + '?_=' + Math.random();
(d.body || d.getElementsByTagName('head')[0]).appendChild(s);
doit(); })
.appendTo($('body'))
, wid_txt = $('<span class="wid_txt" />')
.css(op.txt_style || {'background-color': '#000',
'color': '#FFF',
'padding': '5px',
'box-shadow': '2px 2px 2px #888888',
'border-radius': '10px'})
.html(op.text)
.appendTo(wid_cnt);
})(document, jQuery, {});