-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnsw.js
34 lines (30 loc) · 1.06 KB
/
nsw.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
if (
window.hasOwnProperty('jQuery') && 'function' === typeof window.jQuery &&
window.hasOwnProperty('_') && 'function' === typeof window._
) {
(function ($, _) {
var win = $(window),
newContent;
function getScreenInfoText() {
return window.outerWidth + '×' + window.outerHeight;
}
function getLeftSize() {
return newContent.offset().left + newContent.width();
}
$(document).ready(function () {
newContent = $('#wp-admin-bar-new-content');
if (newContent.length) {
var body = $(document.body),
info = $('<div>', {
id: 'nsi-info',
text: getScreenInfoText()
}).appendTo(body);
win.resize(_.throttle(function () {
info.css({
left: getLeftSize()
}).text(getScreenInfoText());
}, 250)).trigger('resize');
}
});
})(window.jQuery, window._);
}