📄 user.js
字号:
function killerr() {return true}
window.onerror=killerr
//新闻添加
function doChange(objText, objDrop){
if (!objDrop) return;
var str = objText.value;
var arr = str.split("|");
objDrop.length=0;
for (var i=0; i<arr.length; i++){
objDrop.options[i] = new Option(arr[i], arr[i]);
PicUrl=objDrop.options[i].value;
}
document.myform.WM_DefaultPicUrl.value = PicUrl;
myform.WM_PicPreview.src = PicUrl;
myform.WM_PicPreview.alt = PicUrl;
}
/*转向文章新闻添加*/
function WM_LinkCheck(){
if(document.myform.WM_UseLinkUrl.checked==true){
document.myform.WM_LinkUrl.disabled=false;
ArticleContent.style.display='none';
ArticleContent1.style.display='none';
}
else{
document.myform.WM_LinkUrl.disabled=true;
ArticleContent.style.display='';
ArticleContent1.style.display='';
}
}
var c = 0;
function Edit3(ci){if (c==0){ c = 1; ci.style.display = "";}else{ c = 0; ci.style.display = "none";}}
var b = 0;
function Edit2(ci){if (b==0){ b = 1; ci.style.display = "";}else{ b = 0; ci.style.display = "none";}}
//选取所有
function CheckAll(form) {
for (var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked;
}
}
function ClassPost() {
//是否包含电话
var IsTel=/(([0-9]|[0-9]|[零,一,二,三,四,五,六,七,八,九])\W*){7,}/;
//邮箱地址
var IsEmail=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
//检测money
var IsMoney=/^[\d|\.]*$/;
//检测电话
var Isphone=/(^(0\d{2,3})?(-|\s)?(\d{7,8})(-(\d{2,4}))?$)|(^(\+86)?(\s+)?((13)|(15))(\d{9})$)/;
//检测数字
var IsNum=/^\d*$/;
DBC2SBC(document.myform.Email,document.myform.Email.value,0);
DBC2SBC(document.myform.Tel,document.myform.Tel.value,0);
if( myform.title.value ==""){
Loading.style.display="none";
alert("\·请输入广告标题");
document.myform.title.focus();
document.myform.title.select();
return false;}
if (IsTel.test(document.myform.title.value)) {
Loading.style.display="none";
alert("\·广告标题不能带有电话或其它号码");
document.myform.title.focus();
document.myform.title.select();
return false;}
if( EditContent.getHTML() ==""){
Loading.style.display="none";
alert("\·请输入广告内容");
EditContent.HtmlEdit.focus();
return false;}
if( EditContent.getHTML().length <20){
Loading.style.display="none";
alert("\·内容不少于20个字符");
EditContent.HtmlEdit.focus();
return false;}
if( EditContent.getHTML().length >5000){
Loading.style.display="none";
alert("\·内容不多于5000个字符");
EditContent.HtmlEdit.focus();
return false;}
if (IsEmail.test(document.myform.title.value)) {
Loading.style.display="none";
alert("\·广告标题不能带有邮箱地址");
document.myform.title.focus();
document.myform.title.select();
return false;}
if(myform.Price.value!=""){
if (!IsMoney.test(document.myform.Price.value)) {
Loading.style.display="none";
alert("\·参考价格不正确");
document.myform.Price.focus();
document.myform.Price.select();
return false;}
}
if(myform.Email.value!=""){
if (!IsEmail.test(document.myform.Email.value)) {
Loading.style.display="none";
alert("\·邮箱地址不正确");
document.myform.Email.focus();
document.myform.Email.select();
return false;}
}
if(myform.Tel.value!=""){
if (!Isphone.test(document.myform.Tel.value)) {
Loading.style.display="none";
alert("\·联系电话不正确");
document.myform.Tel.focus();
document.myform.Tel.select();
return false;}
}
if(myform.QQ.value!=""){
if (!IsNum.test(document.myform.QQ.value)) {
Loading.style.display="none";
alert("\·QQ填写不正确");
document.myform.QQ.focus();
document.myform.QQ.select();
return false;}
}
if(myform.Email.value =="" && myform.Tel.value =="" && myform.QQ.value ==""){
Loading.style.display="none";
alert("\·在邮箱、电话、QQ三个选项中\n\n·至少填写一样");
document.myform.Email.focus();
document.myform.Email.select();
return false;
}
return true;
}
/*打开关闭UBB帮助*/
var Ukey
Ukey=0;
function UBBHelp(){
if(Ukey==0){
Ukey=1;
UHelp.style.display="";
}else{
Ukey=0;
UHelp.style.display="none";
}
}
//设定图片显示尺寸
var flag=false;
function DrawImage(ImgD,w,h){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= w/h){
if(image.width>w){
ImgD.width=w;
ImgD.height=(image.height*w)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}else{
if(image.height>h){
ImgD.height=h;
ImgD.width=(image.width*h)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
}
//上传操作 Begin ============================================
//上传完成后返回参数处理
function upback(Spic,str){
if(str!=""){
EditContent.appendHTML('<IMG SRC=' + str + ' onload=\"DrawImage(this, 500, 500)\">');
if(Spic!=""){
document.myform.Pic.value = Spic;
Add(Spic);
PicPreview.innerHTML = "<Img src="+Spic+" onload=\'DrawImage(this, 118, 118);\'>";
}else{
document.myform.Pic.value = str;
Add(str);
PicPreview.innerHTML = "<Img src="+str+" onload=\'DrawImage(this, 118, 118);\'>";
}
}
closeWithIframe();
}
function Add(str) {
var sel2=document.myform.PicSelect;
sel2.options[sel2.length]=new Option(str,str);
sel2.selectedIndex = sel2.length-1;
}
function PicReset(str){
document.myform.Pic.value = str;
if (str == ""){
PicPreview.innerHTML = "<Img src=img/nopic.gif onload=\'DrawImage(this, 118, 118);\'>";
}else{
PicPreview.innerHTML = "<Img src="+str+" onload=\'DrawImage(this, 118, 118);\'>";
}
}
//广告图片回传操作
function upad(str){
document.myform.Pic.value = str;
closeWithIframe();
}
//用户头像回传操作
function upother(str){
document.myform.Pic.value = str;
document.images['PicShow'].src=str;
closeWithIframe();
}
//优惠券上传完成后返回参数处理
var ii=0;
function upcou(Spath,path) {
var sel1 = document.myform.PicList.value;
var sel2 = plist.innerHTML;
var path1 = "<div id=l_"+ii+"><a href=# onclick=PicReset('"+Spath+"') alt='做为缩略图'>"+path+"</a> <a href=# onclick=dlist('"+ii+"','"+path+"','"+Spath+"') class=Red>删除</a></div>";
if(sel1!=""){
sel1 = sel1 +'|' + path;
sel2 = sel2 + path1;
}else{
sel1 = path;
sel2 = path1;
}
document.myform.PicList.value = sel1;
plist.innerHTML = sel2;
document.myform.Pic.value = Spath;
PicPreview.innerHTML = "<Img src="+Spath+" onload=\'DrawImage(this, 118, 118);\'>";
closeWithIframe();
ii = ii+1;
}
function dlist(id,str,sStr){
document.getElementById("l_"+id).style.display = "none";
var sel2 = document.myform.PicList.value;
var sel1 = document.myform.Pic.value;
var str1="";
var forpic="";
sel = sel2.split("|");
for(i=0;i<=sel.length;i++){
forpic = sel[i];
if(typeof(forpic) == "undefined"){forpic="";}
if(forpic != "" && forpic != str){
if(str1!=""){
str1 = str1+"|"+sel[i];
}else{
str1 = sel[i];
}
}
}
if(typeof(str1) == "undefined"){str1="";}
if(sel1==sStr || str1==""){
PicReset("");
}
document.myform.PicList.value = str1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -