【rizhuti / ripro弹幕美化教程】日主题与RIPro主题实现全站滚动下载弹幕教程
  •  2019年11月26日

【rizhuti / ripro弹幕美化教程】日主题与RIPro主题实现全站滚动下载弹幕教程

售价:
¥100 积分
  • 普通用户需要积分 : 100积分
  • VIP会员需要积分 :0积分
  • 终身VIP需要积分 : 免费
QQ咨询

特别声明:若资源失效,请联系客服更换分享链接。所有资源均由用户投稿,仅供学习、参考和研究!如有资源侵犯了您的利益和版权请留言告知,我们将立即删除!

升级尊贵会员
享受全站VIP待遇

8w+
会员已经加入
  • 文章介绍
  • 评价建议
  • 在主题根目录下创建server.php文件,并上传到主题根目录下 rizhtu与ripro不一样

    <?php
    /*!
    *@name     server.php
    *@project  jquery.barrager.js
    *@des      日主题弹幕插件
    *@author   Ernie
    *@url      https://www.hnymwl.com
    */
    require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-config.php');
    require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php');
    $list = $wpdb->get_results("SELECT * FROM $wppay_table_name ORDER BY create_time DESC limit 10");
    $mode = intval($_GET['mode']);
    $barrages = array();
    foreach ($list as $value) {
    if ($value->post_id != 0) {
    $info = substr_replace(get_user_by('id', $value->user_id)->user_login, '**', '2') . " 刚刚下载了 " . mb_substr(get_the_title($value->post_id), 0, 8);
    $href = get_permalink($value->post_id);
    } else {
    $info = substr_replace(get_user_by('id', $value->user_id)->user_login, '**', '2') . " 刚刚开通了 VIP";
    $href = home_url('/user?action=vip');
    }
    $img = str_replace('http:', 'https:', get_user_meta($value->user_id)['photo'][0]);
    $new = array(
    'info'   => $info,
    'img'   => $img,
    'href'   => $href,
    'speed'   => 15,
    'color'  =>  '#000',
    'bottom'  => 70,
    'close'  => false
    );
    array_push($barrages, $new);
    };
    if ($mode === 1) {
    echo json_encode($barrages[array_rand($barrages)]);
    } elseif ($mode === 2) {
    echo json_encode($barrages);
    }
    <?php
    /*!
    *@name     server.php
    *@project  jquery.barrager.js
    *@des      RiPro弹幕插件服务端
    *@author   Ernie
    *@url      https://www.hnymwl.com
    */
    require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-config.php');
    require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php');
    $list = $wpdb->get_results("SELECT * FROM $paylog_table_name WHERE status =1 ORDER BY pay_time DESC limit 10");
    $mode = intval($_GET['mode']);
    $barrages = array();
    foreach ($list as $value) {
    $info = substr_replace(get_user_by('id', $value->user_id)->user_login, '**', '2') . " 刚刚下载了 " . mb_substr(get_the_title($value->post_id), 0, 8);
    $img = str_replace('http:', 'https:', get_user_meta($value->user_id)['user_custom_avatar'][0]);
    $href = get_permalink($value->post_id);
    $new = array(
    'info'   => $info,
    'img'   => $img,
    'href'   => $href,
    'speed'   => 15,
    'color'  =>  '#fff',
    'bottom'  => 70,
    'close'  => false
    );
    array_push($barrages, $new);
    };
    if ($mode === 1) {
    echo json_encode($barrages[array_rand($barrages)]);
    } elseif ($mode === 2) {
    echo json_encode($barrages);
    }

    创建jquery.barrager.js文件,并上传到主题的js/文件下,js内容见下方代码

    (function($){$.fn.barrager=function(barrage){barrage=$.extend({close:true,bottom:0,max:10,speed:8,color:"#fff",old_ie_color:"#000000"},barrage||{});var time=new Date().getTime();var barrager_id="barrage_"+time;var id="#"+barrager_id;var div_barrager=$("<div class='barrage' id='"+barrager_id+"'></div>").appendTo($(this));var window_height=$(window).height()-100;var this_height=(window_height>this.height())?this.height():window_height;var window_width=$(window).width()+500;var this_width=(window_width>this.width())?this.width():window_width;var bottom=(barrage.bottom==0)?Math.floor(Math.random()*this_height+40):barrage.bottom;div_barrager.css("bottom",bottom+"px");div_barrager_box=$("<div class='barrage_box cl'></div>").appendTo(div_barrager);if(barrage.img){div_barrager_box.append("<a class='portrait z' href='https://www.hnymwl.com/javascript:;'></a>");var img=$("<img src='' >").appendTo(id+" .barrage_box .portrait");img.attr("src",barrage.img)}div_barrager_box.append(" <div class='z p'></div>");if(barrage.close){div_barrager_box.append(" <div class='close z'></div>")}var content=$("<a title='' href='' target='_blank' rel="noopener noreferrer"></a>").appendTo(id+" .barrage_box .p");content.attr({"href":barrage.href,"id":barrage.id}).empty().append(barrage.info);if(navigator.userAgent.indexOf("MSIE 6.0")>0||navigator.userAgent.indexOf("MSIE 7.0")>0||navigator.userAgent.indexOf("MSIE 8.0")>0){content.css("color",barrage.old_ie_color)}else{content.css("color",barrage.color)}var i=0;div_barrager.css("margin-right",0);$(id).animate({right:this_width},barrage.speed*1000,function(){$(id).remove()});div_barrager_box.mouseover(function(){$(id).stop(true)});div_barrager_box.mouseout(function(){$(id).animate({right:this_width},barrage.speed*1000,function(){$(id).remove()})});$(id+".barrage .barrage_box .close").click(function(){$(id).remove()})};$.fn.barrager.removeAll=function(){$(".barrage").remove()}})(jQuery);$.ajaxSettings.async=false;$.getJSON("https://www.hnymwl.com/wp-content/themes/rizhuti/server.php?mode=2",function(data){var looper_time=5000;var items=data;var total=data.length;var run_once=true;var index=0;barrager();function barrager(){if(run_once){looper=setInterval(barrager,looper_time);run_once=false}$("body").barrager(items[index]);index++;if(index==total){clearInterval(looper);return false}}});

    记得将js文件中的(网址)和(主题名)改为自己的正确路径,别忘了网址的http/https。( A r

    修改主题的header.php文件,引用刚刚创建的js文件,在主题前插入代码

     <script type='text/javascript' src='https://cdn.hnymwl.com/wp-content/themes/rizhuti/js/jquery.barrager.js'></script>

    在主题style.css文件里插入W C q u |样式代码

    .barrage{position: fixed;bottom:70px;right:-500px;display: inline-block;width: 500px;z-index: 99999}
    .barrage_box{background-color: rgba(0,0,0,.5);padding-right: 8px; height: 40px;display: inline-block;border-radius: 25px;transition: all .3s;}
    .barrage_box .portrait{ display: inline-block;margin-top: 4px; margin-left: 4px; width: 32px;height: 32px;border-radius: 50%;overflow: hidden;}
    .barrage_box .portrait img{width: 100%;height: 100%;}
    .barrage_box div.p a{ margin-right: 2px; font-size: 14px;color: #fff;line-height: 40px;margin-left: 18px; }
    .barrage_box div.p a:hover{text-decoration: underline;}
    .barrage_box .close{visibility: hidden;opacity: 0; text-align: center; width:25px;height: 25px;margin-left: 20px;border-radius: 50%;background:rgba(255,255,255,.1);margin-top:8px; background-image: url(close.png);}
    .barrage_box:hover .close{visibility:visible;opacity: 1;}
    .barrage_box .close a{display:block;}
    .barrage_box .close .icon-close{font-size: 14px;color:rgba(255,255,255,.5);display: inline-block;margin-top: 5px; }
    .barrage .z {float: left !important;}
    .barrage  a{text-decoration:none;}

    wordpressB m o: O | a 0P V s y E ` gY e { ^ n } Z `j C J / S? j T& x j * Q / g QR F [ y P 3 m & `_ [ u g U xG y S )D e r ] Z * 3 q1 W 2 M ] iL | } 1 nW M e n rL ] * t t C { 3 ]I – t@ . ~ )J g O i V a U t #. ! @ – *] n ~ a M = dz l L% – : y 7 0 _x & l x x [ {A t ; @ M m J ~ GZ o : c = e. 9 N K F aL l r B * Y = s U$ % { A / n| K –– f | yK ( F m m l E$ q B H Wd ; g t R Z] W 3 K_ r 6 x B x [ Mz u E x 4 K `$ j i e 2 N xz & zq B j . K@ ! ? Y } t u y }B F J {H O x ! I 1 u 2( v 1 r 9 1 ! z 0L m % ~| s g s *. { 9 _ :q K Xy , 0 R +c v } 7{ ( _ , = & ; n ~c ) l M Y jX } S Xz H U _E t r 6 H e ^ * ow c { o p p 2 8& t { + z R ; P0 / 7 R A ! – c! X v P ? f 0 z )9 Q H ] %a v S ^ g R ` Zg & S 4 u tO r GA I / D 9 o 4 n Qy + x 2 x 1 } y ,` 4 {s # ( X h –+ h @ Z # SS { = D ~ 7 f O I% o , ) – v% 9 ; ko 8 = J 2 Z 4 q M1 G 4A 4 w ( q uy X 2, W w 1 S 1 iq w K m , + `C . 3 & o 4@ . | X Sd & UT l b f l bQ ^ 4 ; m 4 + b7 d | i ( 5 Lo ! 0W ; E F V m M 2e @ ~ Z w EX % * , 7 | D f_ ( F e g dP 8 IM + 8 Ci s v ? z = d $R g 5 nB F F H = e b u WC 6 KI j F@ l q 9 p 8 ; ^ BD [ 9 v _ 9 W P v F K / $ S * *O U + t r 9R i M e L x xN 0 R p 0 5 ^N { 9 F6 ` 0 ^ O ; #N G @ c4 p { . , % W T rx V 0 F ? – d ? p t ~ LT 7 v ; c =

    郑重声明:本网站属学习交流,非赢利性网站。在本网站的言论纯属发表者个人意见,与本网站立场无关。涉及侵权与政治言论一律删除,请所有会员注意。网站资源由会员从网上收集整理所得,版权属于原作者。网站所有资源是进行学习和研究测试之用,请在下载后24小时删除。本站出于学习和研究的目的提供平台供会员进行交流和讨论,如有侵犯原作者的版权,请来信告知,提供证明,我们将立即删除相关链接,谢谢合作!我们的邮件地址是: yuanmayu@163.com
    源码鱼 » 【rizhuti / ripro弹幕美化教程】日主题与RIPro主题实现全站滚动下载弹幕教程

    ×