123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775 |
- $(document).ready(function () {
- var languageParameter = localStorage.getItem('language') || 'CN';
- LanguageSwitching();
- if (languageParameter == "CN") {
-
- $('#chinese').addClass(" isSelectLanguage");
- $('#chinese').siblings().removeClass(" isSelectLanguage");
- } else {
- $('#english').addClass(" isSelectLanguage");
- $('#english').siblings().removeClass(" isSelectLanguage");
- }
- $("#iiif").hide();
- $('.logo').on('click', function () {
- localStorage.setItem('logo', true);
- $(location).attr("href", "index.html?logo=true");
- })
-
- var bannerArr = new Array();
- let url = window.location.search;
- var theRequest = new Object();
- if (url.indexOf("?") != -1) {
- var str = url.substr(1);
- strs = str.split("&");
- for (var i = 0; i < strs.length; i++) {
- theRequest[strs[i].split("=")[0]] = unescape(
- decodeURIComponent(strs[i].split("=")[1])
- );
- }
- }
- console.log(theRequest);
- $('.back').on('click', function () {
- let labelname = theRequest.labelname || '';
- let type = theRequest.type || '';
- let name = theRequest.name || 'Asia';
- window.location.href = "index.html?labelname=" +
- labelname +
- "&type=" +
- type +
- "&videotype=" +
- theRequest.videotype +
- "&name=" +
- name;
- })
- $('.videoName').text(theRequest.videoname);
- var uid = localStorage.getItem("uid") || 0;
- if(uid) {
- let uname = localStorage.getItem('username');
- $('.userName').show();
- $('.userName').text(uname);
- $('.myCollection').show();
- $('.loginOut').show();
- $('.userBtn').hide();
- }else{
- $('.userName').hide();
- $('.myCollection').hide();
- $('.loginOut').hide();
- $('.userBtn').show();
- }
-
- // 获取视频id
- var videoid = theRequest.videoid;
- // 获取视频数据
- function getData() {
- let languageParameter = localStorage.getItem('language') || 'CN';
- $.ajax({
- type: 'post',
- url: 'https://www.bibidd.com/bibidd/Mediasix/video_detail',
- dataType: "json",
- data: {
- video_id: videoid,
- LNG:languageParameter
- },
- success: function (res) {
- let videoLabelText = res.type_list.join();
- // 获取推荐视频
- getTuiJianVideoData(videoLabelText);
- // 记录观看视频
- recordWatch(videoLabelText);
- $('.fabulous').find("p").eq(0).text(res.zan);
- let videoSrc = res.data;
- let adv = res.adv;
- $('.headBannerImg').attr('data-original', adv.img);
- $('.headBannerImg').on('click', function() {
- window.location.href = adv.jump_link;
- })
- var loadingUrl = "/Public/bibidd/images/loading.png";
- $(".lazy").lazyload({
- effect: "show",
- placeholder: loadingUrl,
- failurelimit: 10,
- skip_invisible: false,
- });
- let setTimeOutNum = 5;
- let timer = setInterval(function () {
- setTimeOutNum--;
- $('.setTimeOutNum').text(setTimeOutNum);
- }, 1000)
- let iframe = document.getElementById('iiif')
- setTimeout(() => {
- $('.headBannerImg').hide();
- clearInterval(timer);
-
- iframe.src = videoSrc;
- if (iframe.attachEvent) { // IE下
- iframe.attachEvent("onload", function() {
- //后续操作
- $("#iiif").show();
- $(".quanquan").hide();
- });
- } else {
- iframe.onload = function() {
- //后续操作
- $("#iiif").show();
- $(".quanquan").hide();
- };
- }
- }, 5000);
- },
- complete:function(res){
- // 页面渲染
- let videoDetailsData = res.responseJSON.type_list;
- let labelListHtml = '';
- $.each(videoDetailsData, function(index, item){
- labelListHtml += '<div class="labelText">' + item+ '</div>'
- })
- $('.labelList').html(labelListHtml);
- let hhh = $('.labelList').innerHeight();
- if(hhh > 50) {
- $('.expandLabelImg').show();
- }
- $('.labelListBackground').hide();
- // 展开该视频包含标签
- $('.expandLabelImg').on('click', function(){
- $('.labelList').css('height', 'auto');
- $(this).hide();
- })
- // 查看更多标签视频
- $('.labelText').on('click', function(){
- let typename = $(this).text();
- let labelname = theRequest.labelname || '';
- let type = theRequest.type || '';
- let name = theRequest.name || 'Asia';
- $(location).attr('href', 'labelVideoMore.html?typename=' + typename +
- "&labelname=" +
- labelname +
- "&type=" +
- type +
- "&videotype=" +
- theRequest.videotype +
- "&name=" +
- name);
- })
- }
- })
- }
- // 调用 获取视频数据 接口
- getData();
- // 用于获取用户ip地址
- $.get('https://jsonip.com/', function(res){
- var userIp = res.ip;
- });
-
- // 判断该视频是否被收藏
- var collectionStatus;
- function collectionData() {
- $.ajax({
- type: 'post',
- url: 'https://www.bibidd.com/bibidd/Mediasix/yn_shoucang',
- dataType: "json",
- data: {
- type: 'video',
- cid: videoid,
- uid: uid
- },
- success: function (res) {
- },
- complete: function (res) {
- let collectionData = res.responseJSON.message;
- if (collectionData === 'ok') {
- // 已经被收藏
- $('.collection img').attr('src', '/Public/bibidd/images/xingsel.png');
- collectionStatus = true;
- } else {
- $('.collection img').attr('src', '/Public/bibidd/images/xing.png');
- collectionStatus = false;
- }
- }
- })
- }
- if (uid) {
- collectionData();
- }
- // 点赞
- var fabulousStatus = true;
- $('.fabulous').on('click', function () {
- $('.fabulous img').attr('src', '/Public/bibidd/images/loading.gif');
- $.ajax({
- type: 'post',
- url: 'https://www.bibidd.com/bibidd/Mediasix/dianzan_img_video',
- dataType: "json",
- data: {
- type: 'video',
- cid: videoid,
- uid: uid
- },
- success: function (res) {
- let fabulous = $('.fabulous').find("p").eq(0).text();
- $('.fabulous').find("p").eq(0).text(Number(fabulous) + 1);
- $('.fabulous img').attr('src', '/Public/bibidd/images/zan.png');
- }
- })
- })
- var collectionChange = false;
- // 收藏
- $('.collection').on('click', function () {
- if (uid) {
- if (collectionStatus) {
- $('.collection img').attr('src', '/Public/bibidd/images/xing.png');
- collectionclose();
- } else {
- $('.collection img').attr('src', '/Public/bibidd/images/xingsel.png');
- collectionAdd();
- }
- } else {
- // 弹窗提示去登录
- $('.mine').animate({
- width:'100%'
- }, 100)
- }
- })
- // 添加收藏
- function collectionAdd() {
- $.ajax({
- type: 'post',
- url: 'https://www.bibidd.com/bibidd/Mediasix/add_to_shoucang',
- dataType: "json",
- data: {
- type: 'video',
- cid: videoid,
- uid: uid
- },
- success: function (res) {
- },
- complete: function (res) {
- let collectionData = res.responseJSON.message;
- if (collectionData === 'ok') {
- // 已经被收藏
- $('.collection img').attr('src', '/Public/bibidd/images/xingsel.png');
- collectionStatus = true;
- } else {
- $('.collection img').attr('src', '/Public/bibidd/images/xing.png');
- collectionStatus = false;
- if ( languageParameter == 'CN') {
- tip('請稍後再試');
- }else{
- tip('Please try again later');
- }
- }
- }
- })
- }
- // 取消收藏
- function collectionclose() {
- $.ajax({
- type: 'post',
- url: 'https://www.bibidd.com/bibidd/Mediasix/quxiao_shoucang',
- dataType: "json",
- data: {
- type: 'video',
- cid: videoid,
- uid: uid
- },
- success: function (res) {
- },
- complete: function (res) {
- let collectionData = res.responseJSON.message;
- if (collectionData === 'ok') {
- // 已经取消收藏
- $('.collection img').attr('src', '/Public/bibidd/images/xing.png');
- collectionStatus = false;
- } else {
- $('.collection img').attr('src', '/Public/bibidd/images/xingsel.png');
- collectionStatus = true;
- if ( languageParameter == 'CN') {
- tip('請稍後再試');
- }else{
- tip('Please try again later');
- }
- }
- }
- })
- }
- // 获取推荐视频
- function getTuiJianVideoData(videoLabelText) {
- $.ajax({
- type: 'post',
- url: 'https://www.bibidd.com/bibidd/Mediasix/tuijian_shipin',
- dataType: "json",
- data: {
- cid: videoid,
- now_video_type:videoLabelText
- },
- success: function (res) {
- },
- complete: function (res) {
- let dataArray = res.responseJSON.data;
- let videoHtml = '';
- $.each(dataArray, function (index, data) {
- if(data.jump_link) {
- let headBannerHtml =
- `
- <div class="banner">
- <div class="lazy bannerImg" data-original="${data.img}"></div>
- </div>
- `;
- videoHtml += headBannerHtml;
- }else{
- if(data.top_img != 'https://www.bibidd.com/bibidd_testtest/A.jpg') {
- videoHtml += `
- <div id="videoContent${index}" class="videoContent">
- <div class="lazy videoPhoto" data-original="${data.top_img}">
- <div class="videoTime">${videoTime(data.time_chuo)}</div>
- </div>
- <div class="videoTitle">${data.title}</div>
- </div>`;
- }
- }
- })
- $('.video').html(videoHtml);
- var loadingUrl = "/Public/bibidd/images/loading.png";
- $(".lazy").lazyload({
- effect: 'show',
- placeholder: loadingUrl,
- failurelimit: 10,
- skip_invisible: false,
- });
- // 查看视频详情
- $(".videoContent").on("click", function () {
- let thisId = $(this).attr('id');
- let thisIdLength = $(this).attr('id').length;
- let thisIndex = Number(thisId.substring(12, thisIdLength));
- let labelname = theRequest.labelname || '';
- let type = theRequest.type || '';
- let name = theRequest.name || 'Asia';
- $(location).attr("href", "videodetails.html?videoid=" + dataArray[thisIndex].id + "&fabulous=" + dataArray[thisIndex].thumbs_up + "&favorite=" + dataArray[thisIndex].favorite + "&videoname=" + dataArray[thisIndex].title +
- "&labelname=" +
- labelname +
- "&type=" +
- type +
- "&videotype=" +
- theRequest.videotype +
- "&name=" +
- name);
- });
- // 广告详情
- $('.banner').on('click', function() {
-
- window.location.href = dataArray[$(this).index()].jump_link;
- })
- }
- })
- }
- // 记录观看视频
- function recordWatch(videoLabelText) {
- $.ajax({
- type: 'post',
- url: 'https://www.bibidd.com/bibidd/Mediasix/add_user_views',
- dataType: "json",
- data: {
- uid: uid,
- video_type:videoLabelText
- },
- success: function (res) {
- },
- })
- }
- // 时间戳转换
- function formatDateTime(inputTime) {
- var timeStr;
- var date = new Date(inputTime);
- var y = date.getFullYear();
- var m = date.getMonth() + 1;
- m = m < 10 ? "0" + m : m;
- var d = date.getDate();
- d = d < 10 ? "0" + d : d;
- var h = date.getHours();
- h = h < 10 ? "0" + h : h;
- var minute = date.getMinutes();
- var second = date.getSeconds();
- minute = minute < 10 ? "0" + minute : minute;
- second = second < 10 ? "0" + second : second;
- let date1 = new Date(inputTime).getTime(); //开始时间
- let date2 = new Date().getTime(); //结束时间
- let date3 = Math.floor(date2 - date1);
- //计算出相差天数
- let days = Math.floor(date3 / (24 * 3600 * 1000));
- //计算出小时数
- let leave1 = date3 % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
- let hours = Math.floor(leave1 / (3600 * 1000));
- //计算相差分钟数
- let leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
- let minutes = Math.floor(leave2 / (60 * 1000));
- //计算相差秒数
- let leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
- let seconds = Math.round(leave3 / 1000);
- if (days === 0 && hours === 0 && minutes <= 5) {
- // 超过一分钟的显示具体时间,精确到分钟,如:15分钟前。
- // timeStr = minutes < 10 ? "0" + minutes + '分钟前' : minutes + '分钟前';
- timeStr = "just";
- } else if (days === 0 && hours < 1 && minutes >= 5) {
- // 超过一分钟的显示具体时间,精确到分钟,如:15分钟前。
- // timeStr = hours < 10 ? "0" + hours + '小时前' : hours + '小时前';
- timeStr = "Within 1 hour";
- } else if (days === 0 && hours < 24 && hours >= 1) {
- // 超过一分钟的显示具体时间,精确到分钟,如:15分钟前。
- // timeStr = hours < 10 ? "0" + hours + '小时前' : hours + '小时前';
- timeStr = h + ":" + minute;
- }
- return timeStr;
- }
- Date.prototype.format = function (fmt) {
- var o = {
- "M+": this.getMonth() + 1, //月份
- "d+": this.getDate(), //日
- "h+": this.getHours(), //小时
- "m+": this.getMinutes(), //分
- "s+": this.getSeconds(), //秒
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
- "S": this.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o)
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
- };
- function judgeDate(timestamp) { // 判断是否是今天还是昨天,在项目中用于说说时的时间显示
- //昨天的时间
- var day1 = new Date();
- day1.setDate(day1.getDate() - 1);
- var yesterday = day1.format("yyyy-MM-dd");
- //今天的时间
- var day2 = new Date();
- day2.setTime(day2.getTime());
- var today = day2.format("yyyy-MM-dd");
- if (timestamp) {
- var date = new Date(timestamp);
- } else {
- var date = new Date();
- }
- Y = date.getFullYear(),
- m = date.getMonth() + 1,
- d = date.getDate(),
- H = date.getHours(),
- i = date.getMinutes();
- if (m < 10) {
- m = '0' + m;
- }
- if (d < 10) {
- d = '0' + d;
- }
- if (H < 10) {
- H = '0' + H;
- }
- if (i < 10) {
- i = '0' + i;
- }
- var t = Y + '-' + m + '-' + d + ' ' + H + ':' + i;
- if (t.split(" ")[0] == today) {
- // return "今天"+t.split(" ")[1];
- return formatDateTime(timestamp);
- return H + ':' + i;
- } else if (t.split(" ")[0] == yesterday) {
- return "yesterday ";
- } else {
- return m + '-' + d;
- }
- }
- function tip(text) {
- $('#tip').show();
- $('.tiptext').text(text);
- setTimeout(() => {
- $('#tip').hide();
- }, 1000);
- }
- function videoTime(time) {
- let timeStr = "";
- let h =
- Math.floor(time / 60 / 60) < 10
- ? "0" + Math.floor(time / 60 / 60)
- : Math.floor(time / 60 / 60);
- let m =
- Math.floor(Math.floor(time / 60) % 60) < 10
- ? "0" + Math.floor(Math.floor(time / 60) % 60)
- : Math.floor(Math.floor(time / 60) % 60);
- let s =
- Math.floor(time % 60) < 10
- ? "0" + Math.floor(time % 60)
- : Math.floor(time % 60);
- timeStr = h + ":" + m + ":" + s;
- return timeStr;
- }
- var languageIsLong = false;
- $('.language').on('click', function() {
- if(languageIsLong) {
- $('.language img').attr('src', '/Public/bibidd/images/shang.png');
- $(".languageWrap").css('height','50px');
- }else{
- $('.language img').attr('src', '/Public/bibidd/images/xia.png');
- $(".languageWrap").css('height','150px');
- window.scrollTo(0, 99999999999);
- }
- languageIsLong = !languageIsLong;
- })
- $('.languageText').on('click', function() {
- switchLanguage($(this).attr("id"));
- })
-
- function LanguageSwitching() {
-
- var languageParameter = localStorage.getItem('language') || 'CN';
- if ( languageParameter == 'CN') {
- // 切换中文语言
- $("#register").find('p').eq(0).text("註冊");
- $("#login").find('p').eq(0).text("登錄");
- $(".myCollectionTxt").text("我的收藏");
- $(".mineLanguage").find('p').eq(0).text("語言");
- $(".loginOut").text("退出登錄");
-
- $('.language').find('p').eq(0).text('語言');
- $('.footerTitle').text('世界上最大的色情網站');
- $('.footerText').text("9169團隊每天都在更新和添加更多的色情視頻。 我們提供流媒體色情視頻、XXX相册和網絡上排名第一的免費性愛社區。 我們一直在努力新增更多的功能,讓你對色情的熱愛一直保持下去。");
- }else if (!languageParameter || languageParameter == 'EN'){
- // 切换英文语言
- $("#register").find('p').eq(0).text("Sign Up");
- $("#login").find('p').eq(0).text("Sign In");
- $(".myCollectionTxt").text("My collection");
- $(".mineLanguage").find('p').eq(0).text("Language");
- $(".loginOut").text("sign out");
-
- $('.language').find('p').eq(0).text('Language');
- $('.footerTitle').text("The world's largest pornographic website");
- $('.footerText').text("The 9169 team is always updating and adding more porn videos every day.We offer streaming porn videos, XXX photo albums, and the number 1 free sex community on the net. We’re always working towards adding more features that will keep your love for porno alive and well.");
- }
-
- }
- $('.mine').on('click', function(e) {
-
- e.preventDefault();
- $(this).animate({
- width:0
- }, 100)
- })
- // 前往我的收藏
- $('.myCollection').on('click', function() {
- $(location).attr("href", "collection.html");
- })
- // 前往註冊
- $('#login').on('click', function() {
- $(location).attr("href", "blogin.html");
- })
- // 前往登录
- $('#register').on('click', function() {
- $(location).attr("href", "register.html");
- })
- // 退出登录
- $('.myCollection').on('click', function() {
- localStorage.removeItem("uid");
- location.reload();
- })
- // 个人中心切换语言
- $('.languageType div').on('click', function() {
- $(this).addClass(" isSelectLanguage");
- $(this).siblings().removeClass(" isSelectLanguage");
- switchLanguage($(this).attr("id"));
-
- languageIsLong = false;
- })
- // 切换语言
- function switchLanguage (id) {
- languageIsLong = !languageIsLong;
- $(".language img").attr("src", "/Public/bibidd/images/shang.png");
- $(".languageWrap").css('height','50px');
- if (id == "CN" || id == "chinese") {
- // 切换中文
- localStorage.setItem("language", "CN");
- $('#chinese').addClass(" isSelectLanguage");
- $('#chinese').siblings().removeClass(" isSelectLanguage");
- } else {
- // 切换英文
- localStorage.setItem("language", "EN");
- $('#english').addClass(" isSelectLanguage");
- $('#english').siblings().removeClass(" isSelectLanguage");
- }
- LanguageSwitching();
- let labelname = theRequest.labelname || '';
- let type = theRequest.type || '';
- let name = theRequest.name || 'Asia';
- $(location).attr("href",
- "videodetails.html?videoid=" +
- theRequest.videoid +
- "&fabulous=" +
- theRequest.thumbs_up +
- "&favorite=" +
- theRequest.favorite +
- "&videoname=" +
- theRequest.videoname +
- "&labelname=" +
- labelname +
- "&type=" +
- type +
- "&videotype=" +
- theRequest.videotype +
- "&name=" +
- name
- );
- }
- // $(function() {
- // $.ajax({
- // type: "post",
- // url: "https://www.bibidd.com/bibidd/Mediasix/Return_to_ads",
- // dataType: "json",
- // data: {
- // adv_type:'video_beg'
- // },
- // success: function (res) {
- // bannerArr = res.data;
- // $('.headBannerImg').attr('data-original', bannerArr[0].img);
- // $('.headBannerImg').on('click', function() {
- // window.location.href = bannerArr[0].jump_link;
- // })
- // var loadingUrl = "/Public/bibidd/images/loading.png";
- // $(".lazy").lazyload({
- // effect: "show",
- // placeholder: loadingUrl,
- // failurelimit: 10,
- // skip_invisible: false,
- // });
- // let setTimeOutNum = 5;
- // let timer = setInterval(function () {
- // setTimeOutNum--;
- // $('.setTimeOutNum').text(setTimeOutNum);
- // }, 1000)
- // setTimeout(() => {
- // $('.headBannerImg').hide();
- // clearInterval(timer);
- // }, 5000);
- // }
- // })
- // }())
- })
|