Add ".plugin-count" counter to notice panel tag when closed
This commit is contained in:
parent
28ac8f941b
commit
296051fac1
@ -50,3 +50,28 @@
|
|||||||
.notices-above-title .wrap > div.update-nag{
|
.notices-above-title .wrap > div.update-nag{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#meta-link-notices .plugin-count {
|
||||||
|
display: inline-block;
|
||||||
|
/* vertical-align: top; */
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 1px 0 -1px 2px;
|
||||||
|
padding: 0 5px;
|
||||||
|
min-width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
border-radius: 9px;
|
||||||
|
background-color: #72aee6;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.6;
|
||||||
|
text-align: center;
|
||||||
|
z-index: 26;
|
||||||
|
}
|
||||||
|
|
||||||
|
#meta-link-notices .plugin-count.warning {
|
||||||
|
background-color: #dba617;
|
||||||
|
}
|
||||||
|
|
||||||
|
#meta-link-notices .plugin-count.error {
|
||||||
|
background-color: #d63638;
|
||||||
|
}
|
||||||
@ -31,6 +31,7 @@ var NoticeManager = (function ($, document) {
|
|||||||
if (! haveClosed){
|
if (! haveClosed){
|
||||||
NoticeManager.collectNotices();
|
NoticeManager.collectNotices();
|
||||||
}
|
}
|
||||||
|
NoticeManager.addCounter();
|
||||||
});
|
});
|
||||||
|
|
||||||
//original wp focus on click function
|
//original wp focus on click function
|
||||||
@ -43,8 +44,14 @@ var NoticeManager = (function ($, document) {
|
|||||||
// could use event.target instead
|
// could use event.target instead
|
||||||
button.on("click", function () {
|
button.on("click", function () {
|
||||||
if ($(this).hasClass("screen-meta-active")) {
|
if ($(this).hasClass("screen-meta-active")) {
|
||||||
|
if (haveClosed) {
|
||||||
|
NoticeManager.addCounter();
|
||||||
|
}
|
||||||
|
|
||||||
// $(window).scrollTop(true);
|
// $(window).scrollTop(true);
|
||||||
} else {
|
} else {
|
||||||
|
NoticeManager.removeCounter();
|
||||||
|
|
||||||
// wait (500).then(function(){ //still jumpy sometimes - but scrolls to correct position 400 ~ 600
|
// wait (500).then(function(){ //still jumpy sometimes - but scrolls to correct position 400 ~ 600
|
||||||
// $(window).scrollTop(true);
|
// $(window).scrollTop(true);
|
||||||
// });
|
// });
|
||||||
@ -100,6 +107,7 @@ var NoticeManager = (function ($, document) {
|
|||||||
wait(4000).then(() => {
|
wait(4000).then(() => {
|
||||||
if (haveClosed && NoticeManager.getNoticesTopPriority() != 'error') {
|
if (haveClosed && NoticeManager.getNoticesTopPriority() != 'error') {
|
||||||
screenMeta.close(panel, button);
|
screenMeta.close(panel, button);
|
||||||
|
NoticeManager.addCounter();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -158,6 +166,20 @@ var NoticeManager = (function ($, document) {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addCounter: () => {
|
||||||
|
if (!button.children('.plugin-count').length){
|
||||||
|
button.append(
|
||||||
|
$("<span/>").text(notices.length).attr({
|
||||||
|
class: "plugin-count",
|
||||||
|
}).addClass(NoticeManager.getNoticesTopPriority())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
removeCounter: () => {
|
||||||
|
button.children(".plugin-count").remove();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove meta-links-notices if no notices on page
|
* Remove meta-links-notices if no notices on page
|
||||||
* Remove screen-meta-links wrapper if no panels on page
|
* Remove screen-meta-links wrapper if no panels on page
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user