video-template-5

This commit is contained in:
make
2025-05-11 01:31:17 +08:00
parent 309c4ed098
commit dcde3b826c
40 changed files with 4166 additions and 1216 deletions

View File

@@ -0,0 +1,55 @@
/*!
* Copyright 2016-2018 http://v.shoutu.cn
* Email 726662013@qq.com,admin@shoutu.cn
*/
$(document).ready(function($){
var recente=$.cookie("recente");
var len=0;
var canadd=true;
// $.cookie("recente",null,{expires:-1,path: '/'});
// alert(recente);
if(recente){
recente = eval("("+recente+")");
len=recente.length;
$(recente).each(function(){
if(vod_name==this.vod_name){ //已记录则修改
canadd=false;
var json="[";
$(recente).each(function(i){
var temp_name,temp_url,temp_part;
if(this.vod_name==vod_name){
temp_name=vod_name;
temp_url=vod_url;
temp_part=vod_part;
}else{
temp_name=this.vod_name;
temp_url=this.vod_url;
temp_part=this.vod_part;
}
json+="{\"vod_name\":\""+temp_name+"\",\"vod_url\":\""+temp_url+"\",\"vod_part\":\""+temp_part+"\"}";
if(i!=len-1)
json+=",";
})
json+="]";
$.cookie("recente",json,{path:"/",expires:(2)});
return false;
}
});
}
if(canadd){ //无记录则添加
var json="[";
var start=0;
var isfirst="]";
isfirst=!len?"]":",";
json+="{\"vod_name\":\""+vod_name+"\",\"vod_url\":\""+vod_url+"\",\"vod_part\":\""+vod_part+"\"}"+isfirst;
if(len>9)
len-=1;
for(i=0;i<len-1;i++){
json+="{\"vod_name\":\""+recente[i].vod_name+"\",\"vod_url\":\""+recente[i].vod_url+"\",\"vod_part\":\""+recente[i].vod_part+"\"},";
}
if(len>0){
json+="{\"vod_name\":\""+recente[len-1].vod_name+"\",\"vod_url\":\""+recente[len-1].vod_url+"\",\"vod_part\":\""+recente[len-1].vod_part+"\"}]";
}
$.cookie("recente",json,{path:"/",expires:(2)});
}
})

View File

@@ -0,0 +1,773 @@
String.prototype.replaceAll = function(s1,s2){ return this.replace(new RegExp(s1,"gm"),s2); }
String.prototype.trim=function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); }
var base64EncodeChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var base64DecodeChars=new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);function base64encode(str){var out,i,len;var c1,c2,c3;len=str.length;i=0;out="";while(i<len){c1=str.charCodeAt(i++)&0xff;if(i==len){out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt((c1&0x3)<<4);out+="==";break}c2=str.charCodeAt(i++);if(i==len){out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt(((c1&0x3)<<4)|((c2&0xF0)>>4));out+=base64EncodeChars.charAt((c2&0xF)<<2);out+="=";break}c3=str.charCodeAt(i++);out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt(((c1&0x3)<<4)|((c2&0xF0)>>4));out+=base64EncodeChars.charAt(((c2&0xF)<<2)|((c3&0xC0)>>6));out+=base64EncodeChars.charAt(c3&0x3F)}return out}function base64decode(str){var c1,c2,c3,c4;var i,len,out;len=str.length;i=0;out="";while(i<len){do{c1=base64DecodeChars[str.charCodeAt(i++)&0xff]}while(i<len&&c1==-1);if(c1==-1)break;do{c2=base64DecodeChars[str.charCodeAt(i++)&0xff]}while(i<len&&c2==-1);if(c2==-1)break;out+=String.fromCharCode((c1<<2)|((c2&0x30)>>4));do{c3=str.charCodeAt(i++)&0xff;if(c3==61)return out;c3=base64DecodeChars[c3]}while(i<len&&c3==-1);if(c3==-1)break;out+=String.fromCharCode(((c2&0XF)<<4)|((c3&0x3C)>>2));do{c4=str.charCodeAt(i++)&0xff;if(c4==61)return out;c4=base64DecodeChars[c4]}while(i<len&&c4==-1);if(c4==-1)break;out+=String.fromCharCode(((c3&0x03)<<6)|c4)}return out}function utf16to8(str){var out,i,len,c;out="";len=str.length;for(i=0;i<len;i++){c=str.charCodeAt(i);if((c>=0x0001)&&(c<=0x007F)){out+=str.charAt(i)}else if(c>0x07FF){out+=String.fromCharCode(0xE0|((c>>12)&0x0F));out+=String.fromCharCode(0x80|((c>>6)&0x3F));out+=String.fromCharCode(0x80|((c>>0)&0x3F))}else{out+=String.fromCharCode(0xC0|((c>>6)&0x1F));out+=String.fromCharCode(0x80|((c>>0)&0x3F))}}return out}function utf8to16(str){var out,i,len,c;var char2,char3;out="";len=str.length;i=0;while(i<len){c=str.charCodeAt(i++);switch(c>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:out+=str.charAt(i-1);break;case 12:case 13:char2=str.charCodeAt(i++);out+=String.fromCharCode(((c&0x1F)<<6)|(char2&0x3F));break;case 14:char2=str.charCodeAt(i++);char3=str.charCodeAt(i++);out+=String.fromCharCode(((c&0x0F)<<12)|((char2&0x3F)<<6)|((char3&0x3F)<<0));break}}return out}
var MAC={
'Url': document.URL,
'Title': document.title,
'UserAgent' : function(){
var ua = navigator.userAgent;//navigator.appVersion
return {
'mobile': !!ua.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
'ios': !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
'android': ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1, //android终端或者uc浏览器
'iPhone': ua.indexOf('iPhone') > -1 || ua.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器
'iPad': ua.indexOf('iPad') > -1, //是否iPad
'trident': ua.indexOf('Trident') > -1, //IE内核
'presto': ua.indexOf('Presto') > -1, //opera内核
'webKit': ua.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
'gecko': ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') == -1, //火狐内核
'weixin': ua.indexOf('MicroMessenger') > -1 //是否微信 ua.match(/MicroMessenger/i) == "micromessenger",
};
}(),
'Copy': function(s){
if (window.clipboardData){ window.clipboardData.setData("Text",s); }
else{
if( $("#mac_flash_copy").get(0) ==undefined ){ $('<div id="mac_flash_copy"></div>'); } else {$('#mac_flash_copy').html(''); }
$('#mac_flash_copy').html('<embed src='+SitePath+'"images/_clipboard.swf" FlashVars="clipboard='+escape(s)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>');
}
alert("复制成功")
},
'Home': function(o,u){
try{
o.style.behavior='url(#default#homepage)'; o.setHomePage(u);
}
catch(e){
if(window.netscape){
try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}
catch(e){ alert("此操作被浏览器拒绝!请手动设置");}
var moz = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
moz.setCharPref('browser.startup.homepage',u);
}
}
},
'Fav': function(u,s){
try{ window.external.addFavorite(u, s);}
catch (e){
try{window.sidebar.addPanel(s, u, "");}catch (e){ alert("加入收藏出错请使用键盘Ctrl+D进行添加"); }
}
},
'Open': function(u,w,h){
window.open(u,'macopen1','toolbars=0, scrollbars=0, location=0, statusbars=0,menubars=0,resizable=yes,width='+w+',height='+h+'');
},
'Cookie': {
'Set': function(name,value,days){
var exp = new Date();
exp.setTime(exp.getTime() + days*24*60*60*1000);
var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
document.cookie=name+"="+encodeURIComponent(value)+";path=/;expires="+exp.toUTCString();
},
'Get': function(name){
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null){ return decodeURIComponent(arr[2]); return null; }
},
'Del': function(name){
var exp = new Date();
exp.setTime(exp.getTime()-1);
var cval = this.Get(name);
if(cval != null){ document.cookie = name+"="+encodeURIComponent(cval)+";path=/;expires="+exp.toUTCString(); }
}
},
'GoBack':function(){
var ldghost=document.domain;
if(document.referrer.indexOf(ldghost)>0) {
history.back();
}
else{
window.location ="http://"+ldghost;
}
},
'Adaptive':function(){
if(maccms.mob_status=='1'&& maccms.url != maccms.wapurl){
if(document.domain ==maccms.url && MAC.UserAgent.mobile){
location.href = location.href.replace(maccms.url,maccms.wapurl);
}
else if(document.domain ==maccms.wapurl && !MAC.UserAgent.mobile){
location.href = location.href.replace(maccms.wapurl,maccms.url);
}
}
},
'CheckBox':{
'All':function(n){
$("input[name='"+n+"']").each(function() {
this.checked = true;
});
},
'Other':function(n){
$("input[name='"+n+"']").each(function() {
this.checked = !this.checked;
});
},
'Count':function(n){
var res=0;
$("input[name='"+n+"']").each(function() {
if(this.checked){ res++; }
});
return res;
},
'Ids':function(n){
var res=[];
$("input[name='"+n+"']").each(function() {
if(this.checked){ res.push(this.value); }
});
return res.join(",");
}
},
'Qrcode':function(){
$('.mac_qrcode').attr('src','//api.maccms.com/qrcode/?w=150&h=150&url=' + MAC.Url);
},
'Image':{
'Lazyload':{
'Show': function(){
try { $("img.lazy").lazyload(); }catch(e){};
},
'Box': function($id){
$("img.lazy").lazyload({
container: $("#"+$id)
});
}
}
},
'Verify': {
'Init': function(){
MAC.Verify.Focus();
MAC.Verify.Click();
},
'Focus': function(){//验证码框焦点
$('body').on("focus", ".mac_verify", function(){
$(this).removeClass('mac_verify').after(MAC.Verify.Show());
$(this).unbind();
});
},
'Click': function(){//点击刷新
$('body').on('click', 'img.mac_verify_img', function(){
$(this).attr('src', maccms.path +'/index.php/verify/index.html?');
});
},
'Refresh':function(){
$('.mac_verify_img').attr('src', maccms.path +'/index.php/verify/index.html?');
},
'Show':function(){
return '<img class="mac_verify_img" src="'+ maccms.path +'/index.php/verify/index.html?" title="看不清楚? 换一张!">';
}
},
'PageGo':{
'Init':function() {
$('.mac_page_go').click(function () {
var that =$(this);
var url = that.attr('data-url');
var total = that.attr('data-total');
var sp = that.attr('data-sp');
var page= $('#page').val();
if(page>0&&(page<=total)){
url=url.replace(sp + 'PAGELINK',page).replace('PAGELINK',page);
location.href=url;
}
return false;
});
}
},
'Hits': {
'Init':function() {
if($('.mac_hits').length==0){
return;
}
var $that = $(".mac_hits");
$.ajax({
type: 'get',
url: maccms.path + '/index.php/ajax/hits?mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type=update',
timeout: 5000,
dataType: 'json',
error: function () {
},
success: function (json) {
if (json.code == 1) {
$(".mac_hits").each(function(i){
$type = $(".mac_hits").eq(i).attr('data-type');
if($type != 'insert'){
$('.'+$type).html(eval('(json.data.' + $type + ')'));
}
});
}
}
});
}
},
'Score': {
'Init':function(){
if($('.mac_score').length==0){
return;
}
$('body').on('click', '.score_btn', function(e){
MAC.Score.Submit();
});
$.ajax({
type: 'post',
url: maccms.path+'/index.php/ajax/score?mid='+ $('.mac_score').attr('data-mid') +'&id=' +$('.mac_score').attr('data-id'),
timeout: 5000,
error: function(){
$(".mac_score").html('评分加载失败');
},
success: function($r){
MAC.Score.View($r);
}
});
},
'Submit':function(){
var $s = $('.mac_score').find("input[name='score']").val();
$.ajax({
type: 'post',
url: maccms.path+'/index.php/ajax/score?mid='+$('.mac_score').attr('data-mid')+'&id='+$('.mac_score').attr('data-id') + '&score='+ $s,
timeout: 5000,
error: function(){
},
success: function($r){
alert($r.msg)
if($r.code==1){
MAC.Score.View($r);
}
}
});
},
'View':function($r){
$(".rating"+Math.floor($r.data.score)).attr('checked',true);
$(".score_num").text( $r.data.score_num );
$(".score_all").text( $r.data.score_all );
$(".score_pjf").text( $r.data.score );
}
},
'Star': {
'Init':function(){
if($('.mac_star').length==0){
return;
}
$('.mac_star').raty({
starType: 'i',
number: 5,
numberMax : 5,
half: true,
score : function(){
return $(this).attr('data-score');
},
click: function(score, evt) {
$.ajax({
type: 'get',
url: maccms.path+'/index.php/ajax/score?mid='+$('.mac_star').attr('data-mid')+'&id='+$('.mac_star').attr('data-id')+'&score='+(score*2),
timeout: 5000,
dataType:'json',
error: function(){
$('.star_box').attr('title', '网络异常!');
},
success: function(json){
if(json.status == 1){
$('.star_tips').html(json.data.score);
}else{
$('.star_box').attr('title', json.msg);
}
}
});
}
});
}
},
'Digg': {
'Init':function(){
$('body').on('click', '.digg_link', function(e){
var $that = $(this);
if($that.attr("data-id")){
$.ajax({
url: maccms.path + '/index.php/ajax/digg.html?mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type='+$that.attr("data-type"),
cache: false,
dataType: 'json',
success: function($r){
$that.addClass('disabled');
if($r.code == 1){
if($that.attr("data-type")=='up'){
$that.find('.digg_num').html($r.data.up);
}
else{
$that.find('.digg_num').html($r.data.down);
}
}
else{
$that.attr('title', $r.msg);
}
}
});
}
});
}
},
'Gbook':{
'Login':0,
'Verify':0,
'Init':function(){
$('body').on('keyup', '.gbook_content', function(e){
MAC.Remaining($(this),200,'.gbook_remaining')
});
$('body').on('focus', '.gbook_content', function(e){
if(MAC.Gbook.Login==1 && MAC.User.IsLogin!=1){
MAC.User.Login();
}
});
$('body').on('click', '.gbook_submit', function(e){
MAC.Gbook.Submit();
});
},
'Show':function($page){
$.ajax({
type: 'post',
url: maccms.path+'/index.php/gbook/index?page='+$page,
timeout: 3000,
error: function(){
$(".mac_gbook_box").html('留言加载失败,请刷新...');
},
success:function($html){
$(".mac_gbook_box").html($html);
}
});
},
'Submit':function(){
if($(".gbook_content").val() == ''){
alert("请输入留言内容");
return false;
}
$.ajax({
type: 'post',
url: maccms.path + '/index.php/gbook/saveData',
data: $('.gbook_form').serialize(),
success:function($r){
alert($r.msg);
if($r.code == 1){
location.reload();
}
else{
if(MAC.Gbook.Verify==1){
MAC.Verify.Refresh();
}
}
}
});
},
'Report':function(name){
MAC.Pop.Show('#modal-seport',maccms.path+'/index.php/gbook/report?name=' + encodeURIComponent(name),function($r){
$('body').on('click', '#gbook_submit', function(e){
MAC.Gbook.Submit();
});
});
}
},
'Search':{
'Init':function(){
$('.mac_search').click(function(){
var that=$(this);
var url = that.attr('data-href') ? that.attr('data-href') : maccms.path + '/index.php/vod/search.html';
location.href = url + '?wd='+ encodeURIComponent($("#wd").val());
});
},
'Submit':function(){
return false;
}
},
'Suggest':{
'Init':function($obj,$mid,$jumpurl){
try {
$($obj).autocomplete(maccms.path + '/index.php/ajax/suggest?mid=' + $mid, {
inputClass: "mac_input",
resultsClass: "mac_results",
loadingClass: "mac_loading",
width: 175, scrollHeight: 300, minChars: 1, matchSubset: 1,
cacheLength: 10, multiple: false, matchContains: true, autoFill: false,
dataType: "json",
parse: function ($r) {
if ($r.code == 1) {
var parsed = [];
$.each($r['list'], function (index, row) {
row.url = $r.url;
parsed[index] = {
data: row
};
});
return parsed;
} else {
return {data: ''};
}
},
formatItem: function (row, i, max) {
return row.name;
},
formatResult: function (row, i, max) {
return row.text;
}
}).result(function (event, data, formatted) {
$($obj).val(data.name);
location.href = data.url.replace('mac_wd', encodeURIComponent(data.name));
});
}
catch(e){}
}
},
'Ulog':{
'Init':function(){
MAC.Ulog.Set();
MAC.Ulog.Click();
},
'Get':function(){
$.ajax({
url: maccms.path+'/index.php/user/ajax_ulog/?ac=list',
type:'GET',
cache: false,
dataType: 'json',
success: function($r){
if($r.code == 1){
$.each($r['list'],function(index,row){
alert(row.ulog_id);
});
}else{
}
}
});
},
'Set':function(){
if($(".mac_ulog_set").attr('data-mid')){
var $that = $(".mac_ulog_set");
$.get(maccms.path+'/index.php/user/ajax_ulog/?ac=set&mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&sid='+$that.attr("data-sid")+'&nid='+$that.attr("data-nid")+'&type='+$that.attr("data-type"));
}
},
'Click':function(){
$('body').on('click', 'a.mac_ulog', function(e){
//是否需要验证登录
if(MAC.User.IsLogin == 0){
MAC.User.Login();
return;
}
var $that = $(this);
if($that.attr("data-id")){
$.ajax({
url: maccms.path+'/index.php/user/ajax_ulog/?ac=set&mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type='+$that.attr("data-type"),
cache: false,
dataType: 'json',
success: function($r){
alert($r.msg);
if($r.code == 1){
$that.addClass('disabled');
}else{
$that.attr('title', $r.msg);
}
}
});
}
});
}
},
'User':{
'BoxShow':0,
'IsLogin':0,
'UserId':'',
'UserName':'',
'GroupId':'',
'GroupName':'',
'Portrait':'',
'Init':function(){
if($('.mac_user').length >0){
$('body').on('click', '.mac_user', function(e){
MAC.User.Login();
});
}
if(MAC.Cookie.Get('user_id') !=undefined && MAC.Cookie.Get('user_id')!=''){
var url = maccms.path + '/index.php/user';
MAC.User.UserId = MAC.Cookie.Get('user_id');
MAC.User.UserName = MAC.Cookie.Get('user_name');
MAC.User.GroupId = MAC.Cookie.Get('group_id');
MAC.User.GroupName = MAC.Cookie.Get('group_name');
MAC.User.Portrait = MAC.Cookie.Get('user_portrait');
MAC.User.IsLogin = 1;
$('.mac_user').removeClass('mac_user').attr('href',url);
$('.user_name').show().find('.name').text(MAC.User.UserName);
$('.user_url').show().attr('href',url);
$('.user_img').show().attr('src',MAC.User.Portrait);
}
else{
}
},
'CheckLogin':function(){
if(MAC.User.IsLogin == 0){
MAC.User.Login();
}
},
'Login':function(){
var ac='ajax_login';
if(MAC.Cookie.Get('user_id') !=undefined && MAC.Cookie.Get('user_id')!=''){
ac= 'ajax_info';
}
MAC.Pop.Show('#modal-login',maccms.path+'/index.php/user/'+ac,function($r){
$('body').on('click', '#login_form_submit', function(e){
$.ajax({
type: 'POST',
url: maccms.path + '/index.php/user/login',
data: $('.mac_login_form').serialize(),
success:function($r){
if($r.code == 1){
location.reload();
}
}
});
});
});
},
'Logout':function(){
$.ajax({
type: 'post',
url: maccms.path + '/index.php/user/logout',
success:function($r){
alert($r.msg)
if($r.code == 1){
location.reload();
}
}
});
},
'PopedomCallBack':function(trysee,h) {
window.setTimeout(function(){
$(window.frames["player_if"].document).find(".MacPlayer").html(h);
},1000*60*trysee);
},
'BuyPopedom':function(o){
var $that = $(o);
if($that.attr("data-id")){
if (confirm('您确认购买此条数据播放权限吗?')) {
$.ajax({
url: maccms.path + '/index.php/user/ajax_buy_popedom.html?id=' + $that.attr("data-id") + '&sid=' + $that.attr("data-sid") + '&nid=' + $that.attr("data-nid") + '&type=' + $that.attr("data-type"),
cache: false,
dataType: 'json',
success: function ($r) {
$that.addClass('disabled');
alert($r.msg)
if ($r.code == 1) {
top.location.reload();
}
},
complete: function () {
$that.removeClass('disabled');
}
});
}
}
}
},
'Pop':{
'Show':function($modalid,$url,$callback) {
$.ajax({
type: 'post',
url: $url,
timeout: 3000,
error: function(){
$('body').append(alert("加载失败,请刷新"));
},
success:function($r){
$('body').append($r);
$($modalid).modal('show');
$('.MacPlayer').hide();
$($modalid).on('hide.bs.modal', function () {
$('.MacPlayer').show();
})
$callback($r);
}
});
}
},
'AdsWrap':function(w,h,n){
document.writeln('<img width="'+w+'" height="'+h+'" alt="'+n+'" style="background-color: #CCCCCC" />');
},
'Css':function($url){
$("<link>").attr({ rel: "stylesheet",type: "text/css",href: $url}).appendTo("head");
},
'Js':function($url){
$.getScript($url, function(response, status) {
});
},
'Desktop':function(s){
location.href= maccms.path + '/index.php/ajax/desktop?name='+encodeURI(s)+'&url=' + encodeURI(location.href);
},
'Timming':function(){
},
'Error':function(tab,id,name){
},
'AddEm':function(obj,i){
var oldtext = $(obj).val();
$(obj).val( oldtext + '[em:' + i +']' );
},
'Remaining':function(obj,len,show){
var count = len - $(obj).val().length;
if(count < 0){
count = 0;
$(obj).val($(obj).val().substr(0,200));
}
$(show).text(count);
},
'Comment':{
'Login':0,
'Verify':0,
'Init':function(){
$('body').on('click', '.comment_face_box img', function(e){
var obj = $(this).parent().parent().parent().find('.comment_content');
MAC.AddEm(obj,$(this).attr('data-id'));
});
$('body').on('click', '.comment_face_panel', function(e){
// $('.comment_face_box').toggle();
$(this).parent().find('.comment_face_box').toggle();
});
$('body').on('keyup', '.comment_content', function(e){
var obj = $(this).parent().parent().parent().parent().find('.comment_remaining');
MAC.Remaining($(this),200,obj)
});
$('body').on('focus', '.comment_content', function(e){
if(MAC.Comment.Login==1 && MAC.User.IsLogin!=1){
MAC.User.Login();
}
});
$('body').on('click', '.comment_report', function(e){
var $that = $(this);
if($(this).attr("data-id")){
$.ajax({
url: maccms.path + '/index.php/comment/report.html?id='+$that.attr("data-id"),
cache: false,
dataType: 'json',
success: function($r){
$that.addClass('disabled');
alert($r.msg)
if($r.code == 1){
}
}
});
}
});
$('body').on('click', '.comment_reply', function(e){
var $that = $(this);
if($that.attr("data-id")){
var str = $that.html();
$('.comment_reply_form').remove();
if (str == '取消回复') {
$that.html('回复');
return false;
}
if (str == '回复') {
$('.comment_reply').html('回复');
}
var html = $('.comment_form').prop("outerHTML");
var oo = $(html);
oo.addClass('comment_reply_form');
oo.find('input[name="comment_pid"]').val( $that.attr("data-id") );
$that.parent().after(oo);
$that.html('取消回复');
}
});
$('body').on('click', '.comment_submit', function(e){
var $that = $(this);
MAC.Comment.Submit($that);
});
},
'Show':function($page){
if($(".mac_comment").length>0){
$.ajax({
type: 'get',
url: maccms.path + '/index.php/comment/ajax.html?rid='+$('.mac_comment').attr('data-id')+'&mid='+ $('.mac_comment').attr('data-mid') +'&page='+$page,
timeout: 5000,
error: function(){
$(".mac_comment").html('评论加载失败,请刷新...');
},
success:function($r){
$(".mac_comment").html($r);
}
});
}
},
'Reply':function($o){
},
'Submit':function($o){
var form = $o.parents('form');
if($(form).find(".comment_content").val() == ''){
alert("请输入您的评论!")
return false;
}
if($('.mac_comment').attr('data-mid') == ''){
alert("模块mid错误")
return false;
}
if($('.mac_comment').attr('data-id') == ''){
alert("关联id错误")
return false;
}
$.ajax({
type: 'post',
url: maccms.path + '/index.php/comment/saveData',
data: $(form).serialize() + '&comment_mid='+ $('.mac_comment').attr('data-mid') + '&comment_rid=' + $('.mac_comment').attr('data-id'),
success:function($r){
alert($r.msg)
if($r.code == 1){
MAC.Comment.Show(1);
}
else{
if(MAC.Comment.Verify==1){
MAC.Verify.Refresh();
}
}
}
});
}
}
}
$(function(){
//自动跳转手机和pc网页地址
MAC.Adaptive();
//验证码初始化
MAC.Verify.Init();
//分页跳转初始化
MAC.PageGo.Init();
//用户部分初始化
MAC.User.Init();
//顶和踩初始化
MAC.Digg.Init();
//评分初始化
MAC.Score.Init();
//星星评分初始化
MAC.Star.Init();
//点击数量
MAC.Hits.Init();
//历史记录初始化
MAC.Ulog.Init();
//联想搜索初始化
MAC.Suggest.Init('.mac_wd',1,'');
//定时任务初始化
MAC.Timming();
});

View File

@@ -0,0 +1,665 @@
/*
* jQuery Autocomplete plugin 1.1
*
* Copyright (c) 2009 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
*/;
$.browser = navigator.userAgent;
(function($) {
$.fn.extend({
autocomplete: function(urlOrData, options) {
var isUrl = typeof urlOrData == "string";
options = $.extend({}, $.Autocompleter.defaults, {
url: isUrl ? urlOrData : null,
data: isUrl ? null : urlOrData,
delay: isUrl ? $.Autocompleter.defaults.delay : 10,
max: options && !options.scroll ? 10 : 150
}, options);
options.highlight = options.highlight ||
function(value) {
return value;
};
options.formatMatch = options.formatMatch || options.formatItem;
return this.each(function() {
new $.Autocompleter(this, options);
});
},
result: function(handler) {
return this.bind("result", handler);
},
search: function(handler) {
return this.trigger("search", [handler]);
},
flushCache: function() {
return this.trigger("flushCache");
},
setOptions: function(options) {
return this.trigger("setOptions", [options]);
},
unautocomplete: function() {
return this.trigger("unautocomplete");
}
});
$.Autocompleter = function(input, options) {
var KEY = {
UP: 38,
DOWN: 40,
DEL: 46,
TAB: 9,
RETURN: 13,
ESC: 27,
COMMA: 188,
PAGEUP: 33,
PAGEDOWN: 34,
BACKSPACE: 8
};
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
var timeout;
var previousValue = "";
var cache = $.Autocompleter.Cache(options);
var hasFocus = 0;
var lastKeyPressCode;
var config = {
mouseDownOnSelect: false
};
var select = $.Autocompleter.Select(options, input, selectCurrent, config);
var blockSubmit;
$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
if (blockSubmit) {
blockSubmit = false;
return false;
}
});
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
hasFocus = 1;
lastKeyPressCode = event.keyCode;
switch (event.keyCode) {
case KEY.UP:
event.preventDefault();
if (select.visible()) {
select.prev();
} else {
onChange(0, true);
}
break;
case KEY.DOWN:
event.preventDefault();
if (select.visible()) {
select.next();
} else {
onChange(0, true);
}
break;
case KEY.PAGEUP:
event.preventDefault();
if (select.visible()) {
select.pageUp();
} else {
onChange(0, true);
}
break;
case KEY.PAGEDOWN:
event.preventDefault();
if (select.visible()) {
select.pageDown();
} else {
onChange(0, true);
}
break;
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
case KEY.TAB:
if( selectCurrent() ) {
// stop default to prevent a form submit, Opera needs special handling
event.preventDefault();
blockSubmit = true;
return false;
}
break;
case KEY.RETURN:
clearTimeout(timeout);
timeout = setTimeout(onChange, options.delay);
break;
case KEY.ESC:
select.hide();
break;
default:
clearTimeout(timeout);
timeout = setTimeout(onChange, options.delay);
break;
}
}).focus(function() {
hasFocus++;
}).blur(function() {
hasFocus = 0;
if (!config.mouseDownOnSelect) {
hideResults();
}
}).click(function() {
if (hasFocus++ > 1 && !select.visible()) {
onChange(0, true);
}
}).bind("search", function() {
var fn = (arguments.length > 1) ? arguments[1] : null;
function findValueCallback(q, data) {
var result;
if (data && data.length) {
for (var i = 0; i < data.length; i++) {
if (data[i].result.toLowerCase() == q.toLowerCase()) {
result = data[i];
break;
}
}
}
if (typeof fn == "function") fn(result);
else $input.trigger("result", result && [result.data, result.value]);
}
$.each(trimWords($input.val()), function(i, value) {
request(value, findValueCallback, findValueCallback);
});
}).bind("flushCache", function() {
cache.flush();
}).bind("setOptions", function() {
$.extend(options, arguments[1]);
if ("data" in arguments[1]) cache.populate();
}).bind("unautocomplete", function() {
select.unbind();
$input.unbind();
$(input.form).unbind(".autocomplete");
});
function selectCurrent() {
var selected = select.selected();
if (!selected) return false;
var v = selected.result;
previousValue = v;
if (options.multiple) {
var words = trimWords($input.val());
if (words.length > 1) {
var seperator = options.multipleSeparator.length;
var cursorAt = $(input).selection().start;
var wordAt, progress = 0;
$.each(words, function(i, word) {
progress += word.length;
if (cursorAt <= progress) {
wordAt = i;
return false;
}
progress += seperator;
});
words[wordAt] = v;
v = words.join(options.multipleSeparator);
}
v += options.multipleSeparator;
}
$input.val(v);
hideResultsNow();
$input.trigger("result", [selected.data, selected.value]);
return true;
}
function onChange(crap, skipPrevCheck) {
if (lastKeyPressCode == KEY.DEL) {
select.hide();
return;
}
var currentValue = $input.val();
if (!skipPrevCheck && currentValue == previousValue) return;
previousValue = currentValue;
currentValue = lastWord(currentValue);
if (currentValue.length >= options.minChars) {
$input.addClass(options.loadingClass);
if (!options.matchCase) currentValue = currentValue.toLowerCase();
request(currentValue, receiveData, hideResultsNow);
} else {
stopLoading();
select.hide();
}
};
function trimWords(value) {
if (!value) return [""];
if (!options.multiple) return [$.trim(value)];
return $.map(value.split(options.multipleSeparator), function(word) {
return $.trim(value).length ? $.trim(word) : null;
});
}
function lastWord(value) {
if (!options.multiple) return value;
var words = trimWords(value);
if (words.length == 1) return words[0];
var cursorAt = $(input).selection().start;
if (cursorAt == value.length) {
words = trimWords(value)
} else {
words = trimWords(value.replace(value.substring(cursorAt), ""));
}
return words[words.length - 1];
}
function autoFill(q, sValue) {
if (options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE) {
$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
$(input).selection(previousValue.length, previousValue.length + sValue.length);
}
};
function hideResults() {
clearTimeout(timeout);
timeout = setTimeout(hideResultsNow, 200);
};
function hideResultsNow() {
var wasVisible = select.visible();
select.hide();
clearTimeout(timeout);
stopLoading();
if (options.mustMatch) {
$input.search(function(result) {
if (!result) {
if (options.multiple) {
var words = trimWords($input.val()).slice(0, -1);
$input.val(words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : ""));
} else {
$input.val("");
$input.trigger("result", null);
}
}
});
}
};
function receiveData(q, data) {
if (data && data.length && hasFocus) {
stopLoading();
select.display(data, q);
autoFill(q, data[0].value);
select.show();
} else {
hideResultsNow();
}
};
function request(term, success, failure) {
if (!options.matchCase) term = term.toLowerCase();
var data = cache.load(term);
if (data && data.length) {
success(term, data);
} else if ((typeof options.url == "string") && (options.url.length > 0)) {
var extraParams = {
timestamp: +new Date()
};
$.each(options.extraParams, function(key, param) {
extraParams[key] = typeof param == "function" ? param() : param;
});
$.ajax({
mode: "abort",
port: "autocomplete" + input.name,
dataType: options.dataType,
url: options.url,
data: $.extend({
wd: lastWord(term),
limit: options.max
}, extraParams),
success: function(data) {
var parsed = options.parse && options.parse(data) || parse(data);
cache.add(term, parsed);
success(term, parsed);
}
});
} else {
select.emptyList();
failure(term);
}
};
function parse(data) {
var parsed = [];
var rows = data.split("\n");
for (var i = 0; i < rows.length; i++) {
var row = $.trim(rows[i]);
if (row) {
row = row.split("|");
parsed[parsed.length] = {
data: row,
value: row[0],
result: options.formatResult && options.formatResult(row, row[0]) || row[0]
};
}
}
return parsed;
};
function stopLoading() {
$input.removeClass(options.loadingClass);
};
};
$.Autocompleter.defaults = {
inputClass: "ac_input",
resultsClass: "ac_results",
loadingClass: "ac_loading",
minChars: 1,
delay: 400,
matchCase: false,
matchSubset: true,
matchContains: false,
cacheLength: 10,
max: 100,
mustMatch: false,
extraParams: {},
selectFirst: true,
formatItem: function(row) {
return row[0];
},
formatMatch: null,
autoFill: false,
width: 0,
multiple: false,
multipleSeparator: ", ",
highlight: function(value, term) {
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
},
scroll: true,
scrollHeight: 180
};
$.Autocompleter.Cache = function(options) {
var data = {};
var length = 0;
function matchSubset(s, sub) {
if (!options.matchCase) s = s.toLowerCase();
var i = s.indexOf(sub);
if (options.matchContains == "word") {
i = s.toLowerCase().search("\\b" + sub.toLowerCase());
}
if (i == -1) return false;
return i == 0 || options.matchContains;
};
function add(q, value) {
if (length > options.cacheLength) {
flush();
}
if (!data[q]) {
length++;
}
data[q] = value;
}
function populate() {
if (!options.data) return false;
var stMatchSets = {},
nullData = 0;
if (!options.url) options.cacheLength = 1;
stMatchSets[""] = [];
for (var i = 0, ol = options.data.length; i < ol; i++) {
var rawValue = options.data[i];
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
var value = options.formatMatch(rawValue, i + 1, options.data.length);
if (value === false) continue;
var firstChar = value.charAt(0).toLowerCase();
if (!stMatchSets[firstChar]) stMatchSets[firstChar] = [];
var row = {
value: value,
data: rawValue,
result: options.formatResult && options.formatResult(rawValue) || value
};
stMatchSets[firstChar].push(row);
if (nullData++ < options.max) {
stMatchSets[""].push(row);
}
};
$.each(stMatchSets, function(i, value) {
options.cacheLength++;
add(i, value);
});
}
setTimeout(populate, 25);
function flush() {
data = {};
length = 0;
}
return {
flush: flush,
add: add,
populate: populate,
load: function(q) {
if (!options.cacheLength || !length) return null;
if (!options.url && options.matchContains) {
var csub = [];
for (var k in data) {
if (k.length > 0) {
var c = data[k];
$.each(c, function(i, x) {
if (matchSubset(x.value, q)) {
csub.push(x);
}
});
}
}
return csub;
} else if (data[q]) {
return data[q];
} else if (options.matchSubset) {
for (var i = q.length - 1; i >= options.minChars; i--) {
var c = data[q.substr(0, i)];
if (c) {
var csub = [];
$.each(c, function(i, x) {
if (matchSubset(x.value, q)) {
csub[csub.length] = x;
}
});
return csub;
}
}
}
return null;
}
};
};
$.Autocompleter.Select = function(options, input, select, config) {
var CLASSES = {
ACTIVE: "ac_over"
};
var listItems, active = -1,
data, term = "",
needsInit = true,
element, list;
function init() {
if (!needsInit) return;
element = $("<div/>").hide().addClass(options.resultsClass).css("position", "absolute").appendTo(document.body);
list = $("<ul/>").appendTo(element).mouseover(function(event) {
if (target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
$(target(event)).addClass(CLASSES.ACTIVE);
}
}).click(function(event) {
$(target(event)).addClass(CLASSES.ACTIVE);
select();
input.focus();
return false;
}).mousedown(function() {
config.mouseDownOnSelect = true;
}).mouseup(function() {
config.mouseDownOnSelect = false;
});
if (options.width > 0) element.css("width", options.width);
needsInit = false;
}
function target(event) {
var element = event.target;
while (element && element.tagName != "LI") element = element.parentNode;
if (!element) return [];
return element;
}
function moveSelect(step) {
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
movePosition(step);
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
if (options.scroll) {
var offset = 0;
listItems.slice(0, active).each(function() {
offset += this.offsetHeight;
});
if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
} else if (offset < list.scrollTop()) {
list.scrollTop(offset);
}
}
};
function movePosition(step) {
active += step;
if (active < 0) {
active = listItems.size() - 1;
} else if (active >= listItems.size()) {
active = 0;
}
}
function limitNumberOfItems(available) {
return options.max && options.max < available ? options.max : available;
}
function fillList() {
list.empty();
var max = limitNumberOfItems(data.length);
for (var i = 0; i < max; i++) {
if (!data[i]) continue;
var formatted = options.formatItem(data[i].data, i + 1, max, data[i].value, term);
if (formatted === false) continue;
var li = $("<li/>").html(options.highlight(formatted, term)).addClass(i % 2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
$.data(li, "ac_data", data[i]);
}
listItems = list.find("li");
if (options.selectFirst) {
listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
active = 0;
}
if ($.fn.bgiframe) list.bgiframe();
}
return {
display: function(d, q) {
init();
data = d;
term = q;
fillList();
},
next: function() {
moveSelect(1);
},
prev: function() {
moveSelect(-1);
},
pageUp: function() {
if (active != 0 && active - 8 < 0) {
moveSelect(-active);
} else {
moveSelect(-8);
}
},
pageDown: function() {
if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
moveSelect(listItems.size() - 1 - active);
} else {
moveSelect(8);
}
},
hide: function() {
element && element.hide();
listItems && listItems.removeClass(CLASSES.ACTIVE);
active = -1;
},
visible: function() {
return element && element.is(":visible");
},
current: function() {
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
},
show: function() {
var offset = $(input).offset();
element.css({
width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
top: offset.top + input.offsetHeight,
left: offset.left
}).show();
if (options.scroll) {
list.scrollTop(0);
list.css({
maxHeight: options.scrollHeight,
overflow: 'auto'
});
if ($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
var listHeight = 0;
listItems.each(function() {
listHeight += this.offsetHeight;
});
var scrollbarsVisible = listHeight > options.scrollHeight;
list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight);
if (!scrollbarsVisible) {
listItems.width(list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")));
}
}
}
},
selected: function() {
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
return selected && selected.length && $.data(selected[0], "ac_data");
},
emptyList: function() {
list && list.empty();
},
unbind: function() {
element && element.remove();
}
};
};
$.fn.selection = function(start, end) {
if (start !== undefined) {
return this.each(function() {
if (this.createTextRange) {
var selRange = this.createTextRange();
if (end === undefined || start == end) {
selRange.move("character", start);
selRange.select();
} else {
selRange.collapse(true);
selRange.moveStart("character", start);
selRange.moveEnd("character", end);
selRange.select();
}
} else if (this.setSelectionRange) {
this.setSelectionRange(start, end);
} else if (this.selectionStart) {
this.selectionStart = start;
this.selectionEnd = end;
}
});
}
var field = this[0];
if (field.createTextRange) {
var range = document.selection.createRange(),
orig = field.value,
teststring = "<->",
textLength = range.text.length;
range.text = teststring;
var caretAt = field.value.indexOf(teststring);
field.value = orig;
this.selection(caretAt, caretAt + textLength);
return {
start: caretAt,
end: caretAt + textLength
}
} else if (field.selectionStart !== undefined) {
return {
start: field.selectionStart,
end: field.selectionEnd
}
}
};
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,309 @@
/*!
* v3.0 Copyright 2016-2018 http://v.shoutu.cn
* Email 726662013@qq.com
*/
if (window.console && window.console.log) {
}
var playerhigh = "1";
//是否开启播放器高度自适应0关闭1开启开启后将播放器设置100%关闭填写固定高度)
var lazyswitch = "1";
//是否开启图片懒加载0关闭1开启关闭后会通过js直接加载图片速度较慢
var playcolumn = "0";
//是否开启有序播放列表0关闭3、6、8、10、12开启并指定列数数字代表每行列数手机强制4列
var qrcode1 = "1";
//右侧悬浮二维码1自动生成当前页面二维码填写路径将加载指定图片建议尺寸150*150px/statics/img/wxcode.png
var qrcode2 = "1";
//内容页二维码1自动生成当前页面二维码填写路径将加载指定图片建议尺寸160*160px/statics/img/wxcode.png
var copyshort = "0"
//是否开启自动生成短链接0关闭1开启开启后点击分享按钮将会复制短链否则复制默认链接
var baidushare = "";
//是否开启百度分享0关闭启用本地分享填写/statics/api/js/share.js启用官网分享填写http://bdimg.share.baidu.com/static/api/js/share.js不支持https
var stui = {
'browser': {//浏览器
url: document.URL,
domain: document.domain,
title: document.title,
language: (navigator.browserLanguage || navigator.language).toLowerCase(),
canvas: function () {
return !!document.createElement("canvas").getContext
}(),
useragent: function () {
var a = navigator.userAgent;
return {
mobile: !!a.match(/AppleWebKit.*Mobile.*/),
ios: !!a.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
android: -1 < a.indexOf("Android") || -1 < a.indexOf("Linux"),
iPhone: -1 < a.indexOf("iPhone") || -1 < a.indexOf("Mac"),
iPad: -1 < a.indexOf("iPad"),
trident: -1 < a.indexOf("Trident"),
presto: -1 < a.indexOf("Presto"),
webKit: -1 < a.indexOf("AppleWebKit"),
gecko: -1 < a.indexOf("Gecko") && -1 == a.indexOf("KHTML"),
weixin: -1 < a.indexOf("MicroMessenger")
}
}()
},
'mobile': {//移动端
'popup': function () {
$popblock = $(".popup");
$(".open-popup").click(function () {
$popblock.addClass("popup-visible");
$("body").append('<div class="mask"></div>');
$(".close-popup").click(function () {
$popblock.removeClass("popup-visible");
$(".mask").remove();
$("body").removeClass("modal-open")
});
$(".mask").click(function () {
$popblock.removeClass("popup-visible");
$(this).remove();
$("body").removeClass("modal-open")
})
})
},
'slide': function () {
$(".type-slide").each(function (a) {
$index = $(this).find('.active').index() * 1;
if ($index > 3) {
$index = $index - 3;
} else {
$index = 0;
}
$(this).flickity({
cellAlign: 'left',
freeScroll: true,
contain: true,
prevNextButtons: false,
pageDots: false,
initialIndex: $index
});
})
},
'mshare': function () {
$(".open-share").click(function () {
stui.browser.useragent.weixin ? $("body").append('<div class="mobile-share share-weixin"></div>') : $("body").append('<div class="mobile-share share-other"></div>');
$(".mobile-share").click(function () {
$(".mobile-share").remove();
$("body").removeClass("modal-open")
})
})
}
},
'images': {//图片处理
'lazyload': function () {
if (lazyswitch == 1) {
$(".lazyload").lazyload({
effect: "fadeIn",
threshold: 200,
failurelimit: 15,
skip_invisible: false
})
} else {
$(".lazyload").each(function () {
var original = $(this).attr("data-original");
$(this).css("background-image", "url(" + original + ")");
$(this).attr("data-original", "");
if ($(this).attr("src") != undefined) {
$(this).attr("src", original)
}
});
}
},
'carousel': function () {
$('.carousel_default').flickity({
cellAlign: 'left',
contain: true,
wrapAround: true,
autoPlay: true,
prevNextButtons: false
});
$('.carousel_wide').flickity({
cellAlign: 'center',
contain: true,
wrapAround: true,
autoPlay: true
});
$('.carousel_center').flickity({
cellAlign: 'center',
contain: true,
wrapAround: true,
autoPlay: true,
prevNextButtons: false
});
$('.carousel_right').flickity({
cellAlign: 'left',
wrapAround: true,
contain: true,
pageDots: false
}); // 补上右括号和分号
},
'qrcode': function () {
if (qrcode1 == 1) {
if ($("#qrcode").length) {
var qrcode = new QRCode('qrcode', {
text: stui.browser.url,
width: 150,
height: 150,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
});
$("#qrcode img").attr("class", "img-responsive")
}
} else {
if ($("#qrcode").length) {
$("#qrcode").append("<img class='img-responsive' src='" + qrcode1 + "' width='150' height='150' />")
}
}
if (qrcode2 == 1) {
if ($("#qrcode2").length) {
var qrcode = new QRCode('qrcode2', {
text: stui.browser.url,
width: 160,
height: 160,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
});
$("#qrcode2 img").attr("class", "img-responsive").css("display", "inline-block");
}
} else {
if ($("#qrcode2").length) {
$("#qrcode2").append("<img class='img-responsive' src='" + qrcode2 + "' width='160' height='160' />")
}
}
}
},
'common': {//公共基础
'bootstrap': function () {
$('a[data-toggle="tab"]').on("shown.bs.tab", function (a) {
var b = $(a.target).text();
$(a.relatedTarget).text();
$("span.active-tab").html(b)
})
},
'headroom': function () {
if ($("#header-top").length) {
var header = document.querySelector("#header-top");
var headroom = new Headroom(header, {
tolerance: 5,
offset: 205,
classes: {
initial: "top-fixed",
pinned: "top-fixed-up",
unpinned: "top-fixed-down"
}
});
headroom.init();
}
},
'history': function () {
if ($("#stui_history").length) {
if ($.cookie("recente")) {
var json = eval("(" + $.cookie("recente") + ")");
var list = "";
for (i = 0; i < json.length; i++) {
list = list + "<li class='top-line'><a href='" + json[i].vod_url + "' title='" + json[i].vod_name + "'><span class='pull-right text-red'>" + json[i].vod_part + "</span>" + json[i].vod_name + "</a></li>";
}
$("#stui_history").append(list);
}
else
$("#stui_history").append("<p style='padding: 80px 0; text-align: center'>您还没有看过影片哦</p>");
$(".historyclean").on("click", function () {
$.cookie("recente", null, { expires: -1, path: '/' });
})
}
},
'collapse': function () {
if ($(".detail").length) {
$(".detail").find("a.detail-more").on("click", function () {
$(this).parent().find(".detail-sketch").addClass("hide");
$(this).parent().find(".detail-content").css("display", "");
$(this).remove();
})
}
},
'scrolltop': function () {
var a = $(window);
$scrollTopLink = $("a.backtop");
a.scroll(function () {
500 < $(this).scrollTop() ? $scrollTopLink.css("display", "") : $scrollTopLink.css("display", "none")
});
$scrollTopLink.on("click", function () {
$("html, body").animate({
scrollTop: 0
}, 400);
return !1
})
},
'copylink': function () {
if (copyshort == 1) {
if ($(".copylink").length) {
$.ajax({
type: 'GET',
url: 'https://api.weibo.com/2/short_url/shorten.json?source=2849184197&url_long=' + encodeURIComponent(stui.browser.url),
dataType: 'JSONP',
success: function (r) {
url_short = r.data.urls[0].url_short;
var clipboard = new Clipboard('.copylink', {
text: function () {
return url_short;
}
});
clipboard.on('success', function (e) {
alert("地址复制成功,赶快分享给小伙伴吧!");
});
}
});
}
} else {
if ($(".copylink").length) {
var url_short = stui.browser.url;
var clipboard = new Clipboard('.copylink', {
text: function () {
return url_short;
}
});
clipboard.on('success', function (e) {
alert("地址复制成功,赶快分享给小伙伴吧!");
});
}
}
},
'share': function () {
if (baidushare != 0) {
$(".share").html('<span class="bds_shere"></span><a class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a><a class="bds_bdhome" data-cmd="bdhome" title="分享到百度新首页"></a><a class="bds_tqf" data-cmd="tqf" title="分享到腾讯朋友"></a><a class="bds_youdao" data-cmd="youdao" title="分享到有道云笔记"></a><a class="bds_more" data-cmd="more" title="更多"></a>');
window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "24" }, "share": {} }; with (document) 0[(getElementsByTagName("head")[0] || body).appendChild(createElement('script')).src = '' + baidushare + '?cdnversion=' + ~(-new Date() / 36e5)];
}
}
}
};
$(document).ready(function () {
if (stui.browser.useragent.mobile) {
stui.mobile.slide();
stui.mobile.popup();
stui.mobile.mshare();
}
stui.images.lazyload();
stui.images.carousel();
stui.images.qrcode();
stui.common.bootstrap();
stui.common.headroom();
stui.common.history();
stui.common.collapse();
stui.common.scrolltop();
stui.common.copylink();
stui.common.share();
});

File diff suppressed because one or more lines are too long