📄 hutula.js
字号:
var ismore_navs=false;
var ishmenu=false;
$(function(){
$("#more_navs").bind(
"mouseover",
function(){
ismore_navs=true;
show_nav_main();
$("#hide_nav_main").show();
}),
$("#more_navs").bind(
"mouseout",
function(){
ismore_navs=false;
setTimeout('hidemenu()',500);
})
,
$("#hide_nav_main").bind(
"mouseover",
function(){
ishmenu=true;
show_nav_main();
$(this).show();
})
,
$("#hide_nav_main").bind(
"mouseout",
function(){
ishmenu=false;
setTimeout('hidemenu()',500);
})
})
function show_nav_main(){
$("#hide_nav_main").css({
top:$("#more_navs").offset().top+$("#more_navs").height(),
left:$("#more_navs").offset().left+$("#more_navs").width()-$("#hide_nav_main").width()
})
}
function showImage(controlID){
var maxWidth=580;
var maxHeight=580;
var imageArr=document.getElementById(controlID);
if(!imageArr) return;
var imageRate =imageArr.offsetWidth / imageArr.offsetHeight;
if(imageArr.offsetWidth > maxWidth) {
imageArr.style.width=maxWidth + 'px';
imageArr.style.Height=maxWidth / imageRate + 'px';
}
if(imageArr.offsetHeight > maxHeight)
{
imageArr.style.width = maxHeight * imageRate + 'px';
imageArr.style.Height = maxHeight + 'px';
}
}
function hidemenu(){
if(!ismore_navs && !ishmenu){
$("#hide_nav_main").hide();
}
}
/* 随机数 */
function rndnum(n){
var rnd='';
for(var i=0;i<n;i++)
rnd+=Math.floor(Math.random()*10);
return rnd;
}
/* */
/* 视频播放 */
var ap_instances = new Array();
function ap_stopAll(playerID) {
for(var i = 0;i<ap_instances.length;i++) {
try {
if(ap_instances[i] != playerID) document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 1);
else document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 0);
} catch( errorObject ) {
// stop any errors
}
}
}
function ap_registerPlayers() {
var objectID;
var objectTags = document.getElementsByTagName("object");
for(var i=0;i<objectTags.length;i++) {
objectID = objectTags[i].id;
if(objectID.indexOf("audioplayer") == 0) {
ap_instances[i] = objectID.substring(11, objectID.length);
}
}
}
var ap_clearID = setInterval( ap_registerPlayers, 100 );
function ShowMedia(strURL,intWidth,intHeight) {
if(!intWidth) intWidth=533;
if(!intHeight) intHeight=354;
var strMedia="";
var strType='';
var re = new RegExp("\.[a-z0-9]+$","ig");
var strExtend = re.exec(strURL);
strExtend="|"+String(strExtend).toLowerCase()+"|";
if(String("|.swf|").indexOf(strExtend)>=0){strType="SWF"};
if(String("|.mov|.qt|").indexOf(strExtend)>=0){strType="QT"};
if(String("|.wmv|.wmp|.wm|.avi|.mp4|.mpg|.mpeg|.m3u|.pls|.wvx|.wax|.wmx|").indexOf(strExtend)>=0){strType="WMV"};
if(String("|.asf|.asx|.mpa|.mp2|.m1a|.m2a|.aac|").indexOf(strExtend)>=0){strType="WMA"};
if(String("|.wav|.mp3|.wma|").indexOf(strExtend)>=0){strType="MP3"};
if(String("|.rm|.ram|.rmvb|.rpm|.amr|.3gp|.3gpp|.3g2|.3gp2|.rt|.rp|.smi|.smil|").indexOf(strExtend)>=0){strType="RM"};
if(String("|.ra|").indexOf(strExtend)>=0){strType="RA"};
switch(strType){
case "MP3":
var Mp3t_id=Math.round(Math.random()*10000);
strMedia="<object type=\"application/x-shockwave-flash\" data=\"./templates/audioplayer.swf\" width=\"290px\" height=\"24px\" id=\"audioplayer"+Mp3t_id+"\"><param name=\"movie\" value=\"./templates/audioplayer.swf\" /><param name=\"FlashVars\" value=\"playerID="+Mp3t_id+"&soundFile="+strURL+"\"/><param name=\"quality\" value=\"high\" /><param name=\"menu\" value=\"false\" /><param name=\"wmode\" value=\"transparent\" /></object>";
break;
case "SWF":
strMedia="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+intWidth+"\" height=\""+intHeight+"\"><param name=\"wmode\" value=\"Opaque\"><param name=\"movie\" value=\""+strURL+"\"><param name=\"quality\" value=\"high\"><param name=\"play\" value=\"true\"><embed wmode=\"Opaque\" src=\""+strURL+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+intWidth+"\" height=\""+intHeight+"\" play=\"true\"></embed></object>";
break;
case "QT":
strMedia="<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" width=\""+intWidth+"\" height=\""+intHeight+"\" ><param name=\"wmode\" value=\"Opaque\"><param name=\"src\" value=\""+strURL+"\" ><param name=\"autoplay\" value=\"true\" ><embed wmode=\"Opaque\" src=\"qtmimetype.pntg\" type=\"image/x-macpaint\"pluginspage=\"http://www.apple.com/quicktime/download\" qtsrc=\""+strURL+"\" width=\""+intHeight+"\" height=\""+intHeight+"\" autoplay=\"true\" ></embed></object>";
break;
case "WMV":
strMedia="<object classid=\"clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" width=\""+intWidth+"\" height=\""+intHeight+"\"><param name=\"wmode\" value=\"Opaque\"><param name=\"ShowStatusBar\" value=\"-1\"><param wmode=\"Opaque\" name=\"AutoStart\" value=\"true\"><param name=\"Filename\" value=\""+strURL+"\"><embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" src=\""+strURL+"\" autostart=\"true\" width=\""+intWidth+"\" height=\""+intHeight+"\"></embed></object>";
break;
case "WMA":
strMedia="<object classid=\"clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" height=\""+intHeight+"\" width=\""+intWidth+"\"><param name=\"wmode\" value=\"Opaque\"><param name=\"ShowStatusBar\" value=\"-1\"><param name=\"AutoStart\" value=\"true\"><param name=\"Filename\" value=\""+strURL+"\"><embed wmode=\"Opaque\" type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" src=\""+strURL+"\" autostart=\"true\" width=\""+intWidth+"\" height=\""+intHeight+"\"></embed></object>";
break;
case "RM":
strMedia="<object classid=\"clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA\" width=\""+intWidth+"\" height=\""+intHeight+"\"><param name=\"wmode\" value=\"Opaque\"><param name=\"src\" value=\""+strURL+"\"><param name=\"controls\" value=\"imagewindow\"><param name=\"console\" value=\"one\"><param name=\"AutoStart\" value=\"true\"><embed wmode=\"Opaque\" src=\""+strURL+"\" width=\""+intWidth+"\" height=\""+intHeight+"\" type=\"audio/x-pn-realaudio-plugin\" nojava=\"true\" controls=\"imagewindow,ControlPanel,StatusBar\" console=\"one\" autostart=\"true\"></object>";
break;
case "RA":
strMedia="<object classid=\"clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA\" width=\""+intWidth+"\" height=\""+intHeight+"\"><param name=\"wmode\" value=\"Opaque\"><param name=\"src\" value=\""+strURL+"\"><param name=\"controls\" value=\"ControlPanel\"><param name=\"console\" value=\"one\"><param name=\"AutoStart\" value=\"true\"><embed wmode=\"Opaque\" src=\""+strURL+"\" type=\"audio/x-pn-realaudio-plugin\" nojava=\"true\" controls=\"ControlPanel,StatusBar\" console=\"one\" autostart=\"true\" width=\""+intWidth+"\" height=\""+intHeight+"\"></object>";
break;
default:
strMedia="<embed wmode=\"Opaque\" width=\""+intWidth+"\" height=\""+intHeight+"\" class=\"embed\" src=\""+strURL+"\">";
}
document.write(strMedia);
}
/* 视频播放结束 */
/* cookies */
function getCookie(name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
return getCookieVal(j);
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return "";
}
function setCookie(name, value, expires, path, domain, secure) {
var expiresvalue='';
if (expires){
var exp = new Date();
exp.setTime(exp.getTime() + expires*24*60*60*1000);
expiresvalue = exp.toGMTString();
}
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expiresvalue : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function deleteCookie(name,path,domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1) {
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}
function cutstr(str,len)
{
var newLength=0;
var newStr="";
var chineseRegex=/[^\x00-\xff]/g;
var singleChar="";
var strLength=str.replace(chineseRegex,"**").length;
for(var i=0;i<strLength;i++)
{
singleChar=str.charAt(i).toString ();
if(singleChar.match(chineseRegex)!=null)
{
newLength+=2;
}
else
{
newLength++;
}
if(newLength>len)
{
break;
}
newStr+=singleChar;
}
if(strLength>len)
{
newStr+="...";
}
return newStr;
}
function noticewin(s, t, c) {
//s字符串;
//
c = !c ? '' : c;
s = !c ? '<span style="font-style: normal;">'+s+'</span>' : s;
s = '<table cellspacing="0" cellpadding="0" class="popupcredit"><tr><td class="pc_l"> </td><td class="pc_c"><div class="pc_inner">' + s +
(c ? '<a class="pc_btn" href="javascript:;" onclick="display(\'ntcwin\');setcookie(\'discuz_creditnoticedisable\', 1, 31536000);" title="不要再提示我"><img src="' + IMGDIR + '/popupcredit_btn.gif" alt="不要再提示我" /></a>' : '') +
'</td><td class="pc_r"> </td></tr></table>';
if(!$('ntcwin')) {
var div = document.createElement("div");
div.id = 'ntcwin';
div.style.display = 'none';
div.style.position = 'absolute';
div.style.zIndex = '100000';
$('append_parent').appendChild(div);
}
$('ntcwin').innerHTML = s;
$('ntcwin').style.display = '';
$('ntcwin').style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)';
$('ntcwin').style.opacity = 0;
pbegin = document.documentElement.scrollTop + (document.documentElement.clientHeight / 2);
pend = document.documentElement.scrollTop + (document.documentElement.clientHeight / 5);
setTimeout(function () {noticewin_show(pbegin, pend, 0, t)}, 10);
$('ntcwin').style.left = ((document.documentElement.clientWidth - $('ntcwin').clientWidth) / 2) + 'px';
$('ntcwin').style.top = pbegin + 'px';
}
function noticewin_show(b, e, a, t) {
step = (b - e) / 10;
newp = (parseInt($('ntcwin').style.top) - step);
if(newp > e) {
$('ntcwin').style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + a + ')';
$('ntcwin').style.opacity = a / 100;
$('ntcwin').style.top = newp + 'px';
setTimeout(function () {noticewin_show(b, e, a += 10, t)}, 10);
} else {
$('ntcwin').style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)';
$('ntcwin').style.opacity = 1;
setTimeout('display_opacity(\'ntcwin\', 100)', t);
}
}
function display_opacity(id, n) {
if(!$(id)) {
return;
}
if(n >= 0) {
n -= 10;
$(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + n + ')';
$(id).style.opacity = n / 100;
setTimeout('display_opacity(\'' + id + '\',' + n + ')', 50);
} else {
$(id).style.display = 'none';
$(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)';
$(id).style.opacity = 1;
}
}
function chkform(){
$("input[@type='submit']").attr('disabled', true);
setTimeout("$(\"input[@type='submit']\").attr('disabled', false)",3000);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -