为网站添加在线随机小姐姐视频小功能

偶然发现一个为网站添加在线随机小姐姐美女短视频功能,觉得挺新鲜的现在分享出来。现发布是可以正常使用的,视频是来自其他外部网站,失效后自行网上寻找其他随机视频接口,把代码中的替换即可。大致效果如下:

使用方法

将下方代码复制粘贴到你自己的网站侧边栏,或者其他需要展示的地方即可。代码就是简单的js文件,需要有jq库,网站中大多数都有,如果你复制后无法使用可以考虑是不是这个问题。

 
 

<div>

<section id="main">

<video id="player" src="https://dwz.mk/MVZVjy" controls="controls" width="100%" height="400px"></video>

</section>

</div>

<div style="text-align: center;">

<section id="buttons">

<button id="switch">连续: 开</button>

<button id="next1">换一个</button>

</section>

</div>

<script>

(function (window, document) {

if (top != self) {

window.top.location.replace(self.location.href);

}

var get = function (id) {

return document.getElementById(id);

}

var bind = function (element, event, callback) {

return element.addEventListener(event, callback);

}

var auto = true;

var player = get('player');

var randomm = function () {

player.src = 'http://v.nrzj.vip/video.php?_t=' + Math.random();

player.play();

}

bind(get('next1'), 'click', randomm);

bind(player, 'error', function () {

randomm();

});

bind(get('switch'), 'click', function () {

auto = !auto;

this.innerText = '连续: ' + (auto ? '开' : '关');

});

bind(player, 'ended', function () {

if (auto) randomm();

});

})(window, document);</script>

<style>

#switch,#next1{

background: #7F9CCC;

color:#fff;

line-height:40px;

text-align:center;

width:100px;

border:none;

margin:0 6px;

border-radius:6px;

font-weight:bold;

}

</style>

猜你喜欢

转载自blog.csdn.net/m0_71327177/article/details/127591703