mirror of
https://github.com/WenPai-org/wp-china-yes.git
synced 2025-08-07 14:35:20 +08:00
赞助商小部件
This commit is contained in:
parent
7dc13d9329
commit
ae1a550ebd
6 changed files with 171 additions and 1 deletions
84
css/global.css
Normal file
84
css/global.css
Normal file
|
@ -0,0 +1,84 @@
|
|||
.sponsor-item-logo {
|
||||
width: 70px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.sponsor-item-container {
|
||||
height: 70px;
|
||||
display: flex;
|
||||
min-width: 350px;
|
||||
line-height: 24px;
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.sponsor-item-synopsis {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.sponsor-item-title {
|
||||
color: #000;
|
||||
cursor: pointer;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.sponsor-item-title:hover{
|
||||
opacity: 0.5;
|
||||
}
|
||||
.sponsor-item-title-icon{
|
||||
width: 16px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.sponsor-item-content {
|
||||
height: 24px;
|
||||
padding: 0 10px;
|
||||
line-height: 20px;
|
||||
font-size: 12px;
|
||||
margin: 3px 8px 0 0;
|
||||
color: #409eff;
|
||||
border-radius: 4px;
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
background-color: #ecf5ff;
|
||||
border: 1px solid #d9ecff;
|
||||
}
|
||||
|
||||
|
||||
#sponsor-container {
|
||||
height: 300px;
|
||||
overflow: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
#sponsor-container::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
}
|
||||
#sponsor-container::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
background: #d0d1d2;
|
||||
box-shadow: inset 0 0 5px #fff;
|
||||
}
|
||||
#sponsor-container::-webkit-scrollbar-track {
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: inset 0 0 5px #fff;
|
||||
}
|
||||
|
||||
.url-container{
|
||||
padding: 10px 0 0;
|
||||
}
|
||||
|
||||
.url-item{
|
||||
margin: 10px;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.close{
|
||||
float: right;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sponsor-tag-container{
|
||||
white-space: nowrap;
|
||||
}
|
|
@ -1,4 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* 仪表盘赞助商列表小部件
|
||||
*
|
||||
* @author Jialong
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPLv3 Licence
|
||||
*/
|
||||
$plugin_url = plugin_dir_url(__FILE__);
|
||||
echo <<<ETO
|
||||
Hello,World!
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" type="text/css" href="{$plugin_url}css/global.css"/>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div id="sponsor-container"></div>
|
||||
<div class="url-container">
|
||||
<a class="url-item" target="_blank" href="https://www.ibadboy.net/archives/3204.html">项目主页</a>
|
||||
<a href="#" class="url-item addGroup">入群交流</a>
|
||||
<a class="url-item" target="_blank" href="https://www.ibadboy.net/archives/3204.html#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98">常见问题</a>
|
||||
<div class="close">不再显示</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery.ajax({
|
||||
url: "https://wp-mirror-dev.ibadboy.net/api/v1/donors",
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
for (let i = 0; i < data.data.length; i++) {
|
||||
var _html = '<div class="sponsor-item-container">' +
|
||||
'<img class="sponsor-item-logo" src="' + data.data[i].logo_url + '" alt="logo" />' +
|
||||
'<div class="sponsor-item-synopsis">' +
|
||||
'<a href="'+data.data[i].url+'" target="_blank" class="sponsor-item-title">' +
|
||||
'<img class="sponsor-item-title-icon" src="' + getIcon(data.data[i].type) + '" />' +
|
||||
data.data[i].name + '</a>' +
|
||||
'<div class="sponsor-tag-container">' + getSubsidize(data.data[i].mode) + '</div>' + '</div>' +
|
||||
'</div>';
|
||||
jQuery("#sponsor-container").append(_html)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function getIcon(type) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
return '{$plugin_url}image/enterprise.svg';
|
||||
break;
|
||||
case 2:
|
||||
return '{$plugin_url}image/personage.svg';
|
||||
break;
|
||||
case 3:
|
||||
return '{$plugin_url}image/school.svg';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getSubsidize(mode) {
|
||||
var data = mode.split(',')
|
||||
var _html = '';
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
_html += '<div class="sponsor-item-content">' + data[i] + '</div>';
|
||||
}
|
||||
return _html;
|
||||
}
|
||||
|
||||
jQuery('.addGroup').on('click', function () {
|
||||
alert('加入WP中国仓库源建设计划QQ交流群:1046115671')
|
||||
})
|
||||
|
||||
jQuery('.close').on('click', function () {
|
||||
window.open("https://www.ibadboy.net/archives/3683.html");
|
||||
})
|
||||
|
||||
</script>
|
||||
</html>
|
||||
|
||||
ETO;
|
||||
|
|
1
image/clsoe.svg
Normal file
1
image/clsoe.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1585982352556" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11980" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M512 69.818182c-257.070545 0-465.454545 208.384-465.454545 465.454545 0 257.070545 208.384 465.454545 465.454545 465.454545 257.070545 0 465.454545-208.384 465.454545-465.454545C977.454545 278.202182 769.070545 69.818182 512 69.818182zM512 954.181818c-231.377455 0-418.909091-187.531636-418.909091-418.909091 0-231.377455 187.531636-418.909091 418.909091-418.909091 231.377455 0 418.909091 187.531636 418.909091 418.909091C930.909091 766.650182 743.377455 954.181818 512 954.181818zM725.922909 321.349818c-9.076364-9.076364-23.831273-9.076364-32.907636 0L512 502.365091 330.984727 321.349818c-9.076364-9.076364-23.831273-9.076364-32.907636 0-9.076364 9.076364-9.076364 23.831273 0 32.907636l181.015273 181.015273-181.015273 181.015273c-9.076364 9.076364-9.076364 23.831273 0 32.907636 9.076364 9.076364 23.831273 9.076364 32.907636 0L512 568.180364l181.015273 181.015273c9.076364 9.076364 23.831273 9.076364 32.907636 0 9.076364-9.076364 9.076364-23.831273 0-32.907636L544.907636 535.272727l181.015273-181.015273C734.999273 345.181091 734.999273 330.426182 725.922909 321.349818z" p-id="11981"></path></svg>
|
After Width: | Height: | Size: 1.5 KiB |
1
image/enterprise.svg
Normal file
1
image/enterprise.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1585977123594" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1209" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M1001.7 969.6H890.4V399.4c0-27.7-17.4-52.8-43.3-62.5L580 236.7c-14.9-5.6-31.1-5.5-45.7-0.4V76.6c0-21.9-10.7-42.4-28.7-54.9s-41-15.3-61.5-7.6L176.9 114.3c-25.9 9.7-43.3 34.9-43.3 62.5v792.8H22.3C10 969.6 0 979.6 0 991.9s10 22.3 22.3 22.3H1001.8c12.3 0 22.3-10 22.3-22.3s-10.1-22.3-22.4-22.3zM178.1 176.8c0-9.2 5.8-17.6 14.4-20.8L459.7 55.8c7-2.6 14.4-1.7 20.5 2.5s9.6 10.9 9.6 18.3v893H178.1V176.8z m356.2 792.8V299.3c0-7.4 3.5-14.1 9.6-18.3 6.1-4.2 13.6-5.2 20.5-2.5l267.1 100.2c8.6 3.2 14.4 11.6 14.4 20.8v570.2H534.3z" p-id="1210"></path><path d="M391.8 346.3H258.2c-12.3 0-22.3 10-22.3 22.3s10 22.3 22.3 22.3h133.6c12.3 0 22.3-10 22.3-22.3s-10-22.3-22.3-22.3zM748 479.9H614.4c-12.3 0-22.3 10-22.3 22.3s10 22.3 22.3 22.3H748c12.3 0 22.3-10 22.3-22.3s-10-22.3-22.3-22.3zM748 613.4H614.4c-12.3 0-22.3 10-22.3 22.3s10 22.3 22.3 22.3H748c12.3 0 22.3-10 22.3-22.3s-10-22.3-22.3-22.3zM391.8 613.4H258.2c-12.3 0-22.3 10-22.3 22.3s10 22.3 22.3 22.3h133.6c12.3 0 22.3-10 22.3-22.3s-10-22.3-22.3-22.3z" p-id="1211"></path></svg>
|
After Width: | Height: | Size: 1.4 KiB |
1
image/personage.svg
Normal file
1
image/personage.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1585978011339" class="icon" viewBox="0 0 1110 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7930" xmlns:xlink="http://www.w3.org/1999/xlink" width="216.796875" height="200"><defs><style type="text/css"></style></defs><path d="M981.333333 842.666667c1.322667 175.509333-170.666667 170.666667-170.666667 170.666667s-1.173333-68.842667 0-64c46.677333-0.810667 98.325333 11.050667 106.666667-106.666667 6.421333-152.96-147.050667-279.210667-209.045333-323.818667C664.298667 548.16 611.498667 565.333333 554.666667 565.333333s-109.632-17.173333-153.621333-46.485333C339.050667 563.456 185.578667 689.706667 192 842.666667c8.341333 117.717333 60.010667 105.856 106.666667 106.666667 1.152-4.842667 0 64 0 64s-171.989333 4.842667-170.666667-170.666667c0.96-127.146667 126.421333-305.045333 234.922667-354.602667C310.272 437.589333 277.333333 366.698667 277.333333 288 277.333333 134.826667 401.493333 10.666667 554.666667 10.666667c153.173333 0 277.333333 124.16 277.333333 277.333333 0 78.698667-32.938667 149.589333-85.589333 200.064C854.912 537.621333 980.373333 715.52 981.333333 842.666667zM554.666667 74.666667c-117.824 0-213.333333 95.509333-213.333333 213.333333s95.509333 213.333333 213.333333 213.333333c117.824 0 213.333333-95.509333 213.333333-213.333333S672.490667 74.666667 554.666667 74.666667z" p-id="7931"></path></svg>
|
After Width: | Height: | Size: 1.5 KiB |
1
image/school.svg
Normal file
1
image/school.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1586057443927" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3253" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M989.090909 907.636364H954.181818V370.036364c0-30.254545-25.6-55.854545-58.181818-55.854546h-132.654545v-39.563636c0-6.981818 0-25.6-102.4-121.018182-104.727273-97.745455-128-97.745455-137.309091-97.745455-9.309091 0-32.581818 0-141.963637 95.418182-107.054545 95.418182-107.054545 111.709091-107.054545 121.018182v39.563636H146.618182c-32.581818 0-58.181818 25.6-58.181818 55.854546V907.636364H37.236364c-13.963636 0-25.6 11.636364-25.6 25.6 0 13.963636 11.636364 25.6 25.6 25.6l954.181818-2.327273c13.963636 0 25.6-11.636364 25.6-25.6s-13.963636-23.272727-27.927273-23.272727z m-95.418182-542.254546c4.654545 0 6.981818 2.327273 6.981818 4.654546V907.636364h-139.636363V365.381818h132.654545zM414.254545 190.836364c58.181818-51.2 93.090909-76.8 107.054546-81.454546 32.581818 13.963636 169.890909 139.636364 190.836364 172.218182V907.636364h-44.218182v-179.2c0-55.854545-46.545455-100.072727-104.727273-100.072728h-86.109091C418.909091 628.363636 372.363636 672.581818 372.363636 728.436364V907.636364h-51.2V281.6c9.309091-11.636364 44.218182-48.872727 93.090909-90.763636zM616.727273 907.636364h-195.490909v-181.527273c0-27.927273 25.6-48.872727 55.854545-48.872727h86.109091c30.254545 0 55.854545 20.945455 55.854545 48.872727V907.636364zM137.309091 370.036364c0-2.327273 2.327273-4.654545 6.981818-4.654546h125.672727V907.636364H134.981818V370.036364z" p-id="3254"></path><path d="M397.963636 463.127273h225.745455c13.963636 0 25.6-11.636364 25.6-25.6 0-13.963636-11.636364-25.6-25.6-25.6h-225.745455c-13.963636 0-25.6 11.636364-25.6 25.6 2.327273 13.963636 11.636364 25.6 25.6 25.6zM397.963636 558.545455h225.745455c13.963636 0 25.6-11.636364 25.6-25.6s-11.636364-25.6-25.6-25.6h-225.745455c-13.963636 0-25.6 11.636364-25.6 25.6s11.636364 25.6 25.6 25.6zM397.963636 365.381818h225.745455c13.963636 0 25.6-11.636364 25.6-25.6s-11.636364-25.6-25.6-25.6h-225.745455c-13.963636 0-25.6 11.636364-25.6 25.6s11.636364 25.6 25.6 25.6z" p-id="3255"></path></svg>
|
After Width: | Height: | Size: 2.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue