?? personal.js
字號:
// ***********************************************************************************||
// 檢驗密碼強度腳本類
// ***********************************************************************************||
function PasswordStrength(showed){
this.showed = (typeof(showed) == "boolean")?showed:true;
this.styles = new Array();
this.styles[0] = {backgroundColor:"#EBEBEB",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #BEBEBE",borderBottom:"solid 1px #BEBEBE"};
this.styles[1] = {backgroundColor:"#FF4545",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #BB2B2B",borderBottom:"solid 1px #BB2B2B"};
this.styles[2] = {backgroundColor:"#FFD35E",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #E9AE10",borderBottom:"solid 1px #E9AE10"};
this.styles[3] = {backgroundColor:"#95EB81",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #3BBC1B",borderBottom:"solid 1px #3BBC1B"};
this.labels= ["弱","中","強"];
this.divName = "pwd_div_"+Math.ceil(Math.random()*100000);
this.minLen = 5;
this.width = "150px";
this.height = "21px";
this.content = "";
this.selectedIndex = 0;
this.init();
}
PasswordStrength.prototype.init = function(){
var s = '<table cellpadding="0" id="'+this.divName+'_table" cellspacing="0" style="width:'+this.width+';height:'+this.height+';">';
s += '<tr>';
for(var i=0;i<3;i++){
s += '<td id="'+this.divName+'_td_'+i+'" width="33%" align="center"><span style="font-size:1px;"> </span><span id="'+this.divName+'_label_'+i+'" style="display:none;font-family: Courier New, Courier, mono;font-size: 12px;color: #000000; line-height:10px; padding-top:5px;">'+this.labels[i]+'</span></td>';
}
s += '</tr>';
s += '</table>';
this.content = s;
if(this.showed){
document.write(s);
this.copyToStyle(this.selectedIndex);
}
}
PasswordStrength.prototype.copyToObject = function(o1,o2){
for(var i in o1){
o2[i] = o1[i];
}
}
PasswordStrength.prototype.copyToStyle = function(id){
this.selectedIndex = id;
for(var i=0;i<3;i++){
if(i == id-1){
this.$(this.divName+"_label_"+i).style.display = "inline";
}else{
this.$(this.divName+"_label_"+i).style.display = "none";
}
}
for(var i=0;i<id;i++){
this.copyToObject(this.styles[id],this.$(this.divName+"_td_"+i).style);
}
for(;i<3;i++){
this.copyToObject(this.styles[0],this.$(this.divName+"_td_"+i).style);
}
}
PasswordStrength.prototype.$ = function(s){
return document.getElementById(s);
}
PasswordStrength.prototype.setSize = function(w,h){
this.width = w;
this.height = h;
}
PasswordStrength.prototype.setMinLength = function(n){
if(isNaN(n)){
return ;
}
n = Number(n);
if(n>1){
this.minLength = n;
}
}
PasswordStrength.prototype.setStyles = function(){
if(arguments.length == 0){
return ;
}
for(var i=0;i<arguments.length && i < 4;i++){
this.styles[i] = arguments[i];
}
this.copyToStyle(this.selectedIndex);
}
PasswordStrength.prototype.write = function(s){
if(this.showed){
return ;
}
var n = (s == 'string') ? this.$(s) : s;
if(typeof(n) != "object"){
return ;
}
n.innerHTML = this.content;
this.copyToStyle(this.selectedIndex);
}
PasswordStrength.prototype.update = function(s){
if(s.length < this.minLen){
this.copyToStyle(0);
return;
}
var ls = -1;
if (s.match(/[a-z]/ig)){
ls++;
}
if (s.match(/[0-9]/ig)){
ls++;
}
if (s.match(/(.[^a-z0-9])/ig)){
ls++;
}
if (s.length < 6 && ls > 0){
ls--;
}
switch(ls) {
case 0:
this.copyToStyle(1);
break;
case 1:
this.copyToStyle(2);
break;
case 2:
this.copyToStyle(3);
break;
default:
this.copyToStyle(0);
}
}
// ***********************************************************************************||
// 退出時關閉模態窗口
// ***********************************************************************************||
// 關閉打開的模態窗口
function do_close_model(){
if (modelDialog!=null){
if (!modelDialog.closed){
modelDialog.close();
}
}
}
// ***********************************************************************************||
// 資料修改
// ***********************************************************************************||
// 修改基本信息檢測腳本
function on_modify_info(){
if (trim(document.Form1.nick.value)==""){
window.alert("昵稱不能為空。");
document.Form1.nick.focus();
return false;
}
this.imageaffix = function(myimage){
var idotindex = myimage.lastIndexOf(".");
var affix = myimage.substring(idotindex, myimage.length);
return affix.toLowerCase();
}
if (trim(document.Form1.header.value)!=""){
this.myaffixs = ".jpeg.jpg.gif.bmp.png";
if (myaffixs.indexOf(this.imageaffix(document.Form1.header.value))<0){
window.alert("頭像圖片格式不正確,頭像圖片僅支持 JPEG GIF BMP PNG 格式。");
document.Form1.header.focus();
return false;
}
}
$("bok").disabled = true;
return true;
}
// 預覽頭像
function previewheader(file, image, maxsize){
this.mytimer;
this.myimage = new Image();
this.myaffixs = ".jpeg.jpg.gif.bmp.png";
this.imageaffix = function(myimage){
var idotindex = myimage.lastIndexOf(".");
var affix = myimage.substring(idotindex, myimage.length);
return affix.toLowerCase();
}
this.imageshow = function(){
if (myimage.width>0){
if (myimage.width>maxsize || myimage.height>maxsize){
if (myimage.width < myimage.height){
$(image).width = maxsize;
$(image).height = Math.floor((myimage.height * maxsize) / myimage.width);
$(image).src = myimage.src;
}else{
$(image).height = maxsize;
$(image).width = Math.floor((myimage.width * maxsize) / myimage.height);
$(image).src = myimage.src;
}
}else{
$(image).width = myimage.width;
$(image).height = myimage.height;
$(image).src = myimage.src;
}
window.clearInterval(this.mytimer);
}
}
if (myaffixs.indexOf(this.imageaffix(file.value))>=0){
myimage.src = file.value;
this.mytimer = window.setInterval(this.imageshow, 100);
}
}
// 修改密碼安全信息檢測腳本
function on_modify_safe(){
if (trim(document.Form1.oldpass.value)==""){
window.alert("舊密碼不能為空。");
document.Form1.oldpass.focus();
return false;
}
if (trim(document.Form1.password.value)==""){
window.alert("新密碼不能為空。");
document.Form1.password.focus();
return false;
}else{
if (document.Form1.password.value!=document.Form1.confirm.value){
window.alert("新密碼確認失敗,兩次輸入不相同。");
document.Form1.confirm.focus();
return false;
}
}
$("bok").disabled = true;
return true;
}
// ***********************************************************************************||
// 站內消息
// ***********************************************************************************||
// 查詢收到的站內消息
function do_message_search(){
if (trim($("searchkey").value)==""){
window.alert("查詢關鍵字不能為空");
}else{
document.Form1.submit();
}
}
// 刪除選中的站內消息
function do_message_deletes(){
if (sc_select_count($n('Message'))>0){
if (confirm("您確定要刪除選中的消息嗎?")){
document.Form1.Command.value = "Delete";
document.Form1.action = "../../service/message_action.aspx";
document.Form1.submit();
}
}else{
window.alert("您沒有選擇任何消息,無法繼續操作");
}
}
// 查詢最近聯系
function do_message_recvs_regular(){
$("bregular").disabled = true;
$("blatest").disabled = false;
$("bgrader").disabled = false;
$("bsearch").disabled = false;
$("_method").value = "Regular";
$("_pageid").value = "1";
$("ls_name").innerHTML = "最常聯系會員";
get_user_list();
}
// 查詢最常聯系
function do_message_recvs_latest(){
$("bregular").disabled = false;
$("blatest").disabled = true;
$("bgrader").disabled = false;
$("bsearch").disabled = false;
$("_method").value = "Latest";
$("_pageid").value = "1";
$("ls_name").innerHTML = "最近聯系會員";
get_user_list();
}
// 查詢同組會員
function do_message_recvs_grader(){
$("bregular").disabled = false;
$("blatest").disabled = false;
$("bgrader").disabled = true;
$("bsearch").disabled = false;
$("_method").value = "Grader";
$("_pageid").value = "1";
$("ls_name").innerHTML = "與我同組會員";
get_user_list();
}
// 昵稱查詢
function do_message_recvs_search(){
if (trim($("searchkey").value)==""){
window.alert("查詢關鍵字不能為空。");
$("searchkey").focus();
return false;
}else{
$("bregular").disabled = false;
$("blatest").disabled = false;
$("bgrader").disabled = false;
$("bsearch").disabled = false;
$("_method").value = "Search";
$("_pageid").value = "1";
$("ls_name").innerHTML = "會員查詢";
get_user_list();
}
}
// 獲取聯系人列表
function get_user_list(){
this.success = function(t){
$("div_list").innerHTML = t;
}
this.error = function(){
$("div_list").innerHTML = "<div class='cls_error'>查詢用戶信息失敗</div>";
}
$("div_list").innerHTML = "<div class='cls_progress'>正在查詢用戶信息,請等待...</div>";
var theajax = new ajax(false, this.success, this.error);
theajax.get("../../Service/Ajax_Action.aspx?Command=User_Find&method="+$("_method").value+"&searchkey="+escape($("searchkey").value)+"&pageid="+$("_pageid").value, true);
}
// 選擇收件人
function do_message_recvs_find(){
if (isiexplorer()){
var retval = window.showModalDialog("contact.aspx", window, "dialogWidth:640px; dialogHeight:480px; status:yes; directories:yes; scrollbars:no; resizable=no; help: no;");
if( retval != null && trim(retval)!="" ) { document.Form1.recvs.value = retval; }
}else{
modelDialog = window.open("contact.aspx", "_blank", "width=640,height=480,scroolbars=0");
}
}
// 清空收件人
function do_message_recvs_clear(){
document.Form1.recvsid.value = "";
document.Form1.recvsnick.value = "";
document.Form1.recvs.value = "";
}
// 發送消息時的檢測腳本
function on_message_post_check(){
do_close_model();
if (trim(document.Form1.title.value)==""){
window.alert("標題不能為空。");
document.Form1.title.focus();
return false;
}
if (trim(document.Form1.recvsid.value)==""){
window.alert("收件人不能為空。");
return false;
}
if (trim(document.Form1.content.value)==""){
window.alert("內容不能為空。");
document.Form1.content.focus();
return false;
}
return true;
}
// 選中確定的用戶
function do_message_recvs_select(){
var _scount = sc_select_count($n("Recv"));
if (_scount>0){
var _recvsid = (isiexplorer())?window.dialogArguments.Form1.recvsid.value:window.opener.document.Form1.recvsid.value;
var _recvsnick = (isiexplorer())?window.dialogArguments.Form1.recvsnick.value:window.opener.document.Form1.recvsnick.value;
if (typeof(document.Form1.Recv.length)=="undefined")
{
var _id = document.Form1.Recv.value;
if (document.Form1.Recv.checked && (_recvsid.indexOf(","+_id)==-1 && _recvsid.indexOf(_id+",")==-1 && trim(_recvsid)!=_id) ){
if (trim(_recvsid)==""){
_recvsid += document.Form1.Recv.value;
_recvsnick += document.Form1.Recv.title;
}else{
_recvsid += "," + document.Form1.Recv.value;
_recvsnick += "," + document.Form1.Recv.title;
}
}
}else{
for(i=0;i<document.Form1.Recv.length;i++){
var _id = document.Form1.Recv[i].value;
if (document.Form1.Recv[i].checked && (_recvsid.indexOf(","+_id)==-1 && _recvsid.indexOf(_id+",")==-1 && trim(_recvsid)!=_id) ){
if (trim(_recvsid)==""){
_recvsid += document.Form1.Recv[i].value;
_recvsnick += document.Form1.Recv[i].title;
}else{
_recvsid += "," + document.Form1.Recv[i].value;
_recvsnick += "," + document.Form1.Recv[i].title;
}
}
}
}
if (isiexplorer()){
window.dialogArguments.Form1.recvsid.value = _recvsid;
window.dialogArguments.Form1.recvsnick.value = _recvsnick;
window.returnValue = _recvsnick;
window.close();
}else{
window.opener.document.Form1.recvsid.value = _recvsid;
window.opener.document.Form1.recvsnick.value = _recvsnick;
window.opener.document.Form1.recvs.value = _recvsnick;
window.close();
}
}else{
window.alert("沒有選擇任何用戶。");
}
}
// 刪除選中的站內消息
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -