欢迎各位兄弟 发布技术文章
这里的技术是共享的
//jQuery(document).ready(function(){
// var timer = null;
// jQuery("#views-exposed-form-list-cjdntj-page [name='name']")
// .add("#views-exposed-form-list-cjdntj-page [name='field_full_name_value']")
// .add("#views-exposed-form-list-cjdntj-page [name='field_development_value']")
// .add("#views-exposed-form-list-cjdntj-page [name='field_wireless_mac_value']")
// .add("#views-exposed-form-list-cjdntj-page [name='field_wired_mac_value']")
// .keyup(function(event){
// if(timer) {
// clearTimeout(timer);
// }
// timer = setTimeout(function(){
// jQuery('#edit-submit-list-cjdntj').click();
// },300);
// });
//});
//
function _quest(name){
Request = {
QueryString : function(item){
var svalue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)","i"));
return svalue ? svalue[1] : svalue;
}
}
var value = Request.QueryString(name);
return value;
}
function _test_three_in_four(str){
var bool_num = 0;
var r = /\d/g;
if(r.test(str)){
bool_num = bool_num+1;
}
r = /[a-z]/g;
if(r.test(str)){
bool_num = bool_num+1;
}
r = /[A-Z]/g;
if(r.test(str)){
bool_num = bool_num+1;
}
r = /[~!@#$%^&*()\_+`\-=\[\]\|\\\\{};':\",\.\/<>\?]/;
if(r.test(str)){
bool_num = bool_num+1;
}
return bool_num >= 3;
}
jQuery(document).ready(function(){
jQuery('.da_dian_hua_from').hover(
function(){
jQuery(this).siblings('.da_dian_hua_to').css('display','block')
},
function(){
jQuery(this).siblings('.da_dian_hua_to').css('display','none');
}
);
if(window.localStorage.getItem("mac")!=null){ jQuery('#get_mac_address').html(window.localStorage.getItem("mac")); }
if(jQuery('.views-field-field-jses-device-name')[0]!=null){
jQuery('.views-field-field-jses-device-name').each(function(index,obj){
var str = jQuery(obj).html();
jQuery(obj).html(str.replace('.luxshare.com.cn',''));
})
};
function _show_hidden_netlevel_option()
{
if(jQuery('#edit-field-jses-area-und').val()=='a1_npi' || jQuery('#edit-field-jses-area-und').val()=='a1_mp' || jQuery('#edit-field-jses-area-und').val()=='a2_mp' || jQuery('#edit-field-jses-area-und').val()=='a_mp' || jQuery('#edit-field-jses-area-und').val()=='b_mp' ){
jQuery('#edit-field-jses-netlevel-und').find('option').show();
jQuery("#edit-field-jses-netlevel-und option[value='_none']").hide();
jQuery("#edit-field-jses-netlevel-und option[value='l0']").hide();
}
else if(jQuery('#edit-field-jses-area-und').val()=='a_cpc' || jQuery('#edit-field-jses-area-und').val()=='b_cpc' ){
jQuery('#edit-field-jses-netlevel-und').find('option').show();
jQuery("#edit-field-jses-netlevel-und option[value='l0']").hide();
jQuery("#edit-field-jses-netlevel-und option[value='l1']").hide();
jQuery("#edit-field-jses-netlevel-und option[value='l2']").hide();
jQuery("#edit-field-jses-netlevel-und option[value='l4']").hide();
}
else if(jQuery('#edit-field-jses-area-und').val()=='a_office' || jQuery('#edit-field-jses-area-und').val()=='b_office' ){
jQuery('#edit-field-jses-netlevel-und').find('option').show();
jQuery("#edit-field-jses-netlevel-und option[value='l2']").hide();
jQuery("#edit-field-jses-netlevel-und option[value='l3']").hide();
jQuery("#edit-field-jses-netlevel-und option[value='l4']").hide();
}
}
_show_hidden_netlevel_option();
jQuery('#edit-field-jses-area-und').change(function(){
_show_hidden_netlevel_option();
});
jQuery('.preview_permission_group').click(function(){
jQuery('.query_ad_info_user_profile_form').fadeToggle();
//var diqu = _quest('diqu');
//jQuery.ajax({
// type:"GET",
// url: "/show_all_memberof",
// cache: false,
// dataType: 'json',
// data: {"diqu" : diqu},
// success: function(result)
// {
// jQuery('#edit-msg').html(result.data);
//
// },
// error: function(){
// },
//});
});
jQuery('#all_gh').click(function(){
jQuery(":checkbox[name='one_gh[]']").prop('checked', this.checked);
});
jQuery(".batch_ad_member_form").submit(function(e){
var all_select_ghs = '';
jQuery(":checkbox[name='one_gh[]']:checked").each(function(){
if(all_select_ghs==''){
all_select_ghs = jQuery(this).val();
}else{
all_select_ghs += ','+jQuery(this).val();
}
});
jQuery("[name='all_select_ghs']").val(all_select_ghs);
});
jQuery('#all_pre_del_ghs').click(function(){
jQuery(":checkbox[name='pre_del_ghs[]']").prop('checked', this.checked);
});
jQuery('.delete_from_authorities').click(function(){
var all_select_del_ghs = '';
jQuery(":checkbox[name='pre_del_ghs[]']:checked").each(function(){
if(all_select_del_ghs==''){
all_select_del_ghs = jQuery(this).val();
}else{
all_select_del_ghs += ','+jQuery(this).val();
}
});
var d = window.confirm("确定要从权限组中删除这个用户吗?");
if(d){
location.href='/del_user_from_author?pre_del_ghs='+all_select_del_ghs+'&ad_memberof='+jQuery('#edit-ad-memberof').val();
}
});
jQuery('.delete_one_from_authorities').click(function(){
var gh_and_field_full_name_value = jQuery(this).parent('td').parent('tr').children('.gh_and_field_full_name_value').html();
return window.confirm("确定要从权限组中删除这个用户 "+gh_and_field_full_name_value+" 吗?");
});
jQuery('.do_view_ad_pwd').click(function(){
if(jQuery(this).html() == '显示'){
jQuery(this).html('隐藏');
jQuery(this).siblings('.view_ad_pwd').html(jQuery(this).parents('.form-type-password').children("input[type='password']").val());
jQuery(this).siblings('.view_ad_pwd').css('display','inline-block');
}else{
jQuery(this).html('显示');
jQuery(this).siblings('.view_ad_pwd').css('display','none');
}
});
jQuery("input[type='password']").keyup(function(){
var pwd_val = jQuery(this).val();
jQuery(this).parent().find('.view_ad_pwd').html(jQuery(this).val());
if(pwd_val.length<14){
jQuery(this).parent().find('.pwd_error').html("密码长度是"+pwd_val.length+"位,小于14位");
}else if(!_test_three_in_four(pwd_val)){
jQuery(this).parent().find('.pwd_error').html("密码必须有大写,小写,数字,符号这四种中的三种!");
}else{
jQuery(this).parent().find('.pwd_error').html('');
}
})
function ajax_modify_jamf_computer_name($jamf_name_hidden,name,id)
{
var newvalue = _quest('new');
if(newvalue == null){
newvalue = 0
}
jQuery.ajax({
type:"POST",
url: "/ajax_update_jamf_name_by_id?new="+newvalue,
cache: false,
dataType: 'json',
data: {"name" : name,"id":id},
success: function(result)
{
if(result.status == 'ok'){
$jamf_name_hidden.html(result.data);
}else {
$jamf_name_hidden.html('未能成功修改计算机名称');
}
setTimeout(function(){
$jamf_name_hidden.fadeOut();
},2000);
},
error: function(){
console.log(result);
},
});
}
jQuery('.jamf_name_button').click(function(){
var $jamf_name_hidden = jQuery(this).siblings('.jamf_name_hidden')
$jamf_name_hidden.css('display','block');
$jamf_name_hidden.html("<img src='/misc/throbber-active.gif' />");
var name = jQuery(this).siblings('.jamf_name_text').val();
var id = jQuery(this).siblings('.jamf_name_text').attr('attr_id');
ajax_modify_jamf_computer_name($jamf_name_hidden,name,id)
});
jQuery('.jamf_name_text').keyup(function(event) {
if (event.which == 13) { // 按下的键的 ASCII 码是 13,这就是 Enter 键
// 这里插入你希望在按下 Enter 键时执行的代码
var $jamf_name_hidden = jQuery(this).siblings('.jamf_name_hidden')
$jamf_name_hidden.css('display','block');
$jamf_name_hidden.html("<img src='/misc/throbber-active.gif' />");
var name = jQuery(this).val();
var id = jQuery(this).attr('attr_id');
ajax_modify_jamf_computer_name($jamf_name_hidden,name,id)
}
});
jQuery('.jamf_static_group_select').change(function() {
var $jamf_name_hidden = jQuery(this).siblings('.jamf_static_group_hidden')
$jamf_name_hidden.css('display','block');
$jamf_name_hidden.html("<img src='/misc/throbber-active.gif' />");
var group = jQuery(this).val();
jamf_static_group_hidden = jQuery(this).siblings('.jamf_static_group_hidden');
var id = jamf_static_group_hidden.attr('attr_id');
var newvalue = _quest('new');
if(newvalue == null){
newvalue = 0
}
jQuery.ajax({
type:"POST",
url: "/ajax_update_jamf_static_group_by_id?new="+newvalue,
cache: false,
dataType: 'json',
data: {"group" : group,"id":id,},
success: function(result)
{
if(result.status == 'ok'){
jamf_static_group_hidden.html(result.data);
jamf_static_group_hidden.parent('td').siblings('td.jamf_static_group_text').fadeOut('normal',function(){
jQuery(this).html(result.new_group);
jQuery(this).fadeIn();
});
//jamf_static_group_hidden.parent('td').siblings('td.jamf_static_group_text').html(result.new_group);
//jamf_static_group_hidden.parent('td').siblings('td.jamf_static_group_text').fadeIn();
setTimeout(function(){
jamf_static_group_hidden.fadeOut();
},1300);
//setTimeout(function(){
// location.href=location.href;
//},200);
}else {
jamf_static_group_hidden.html('未能成功修改静态组');
setTimeout(function(){
jamf_static_group_hidden.fadeOut();
},3000);
}
},
error: function(){
console.log(result);
},
});
});
jQuery('.jamf_group_checkbox').change(function() {
var $jamf_group_hidden = jQuery(this).siblings('.jamf_group_hidden')
$jamf_group_hidden.css('display','block');
$jamf_group_hidden.html("<img src='/misc/throbber-active.gif' />");
var meetingroom_exclusion = jQuery(this).val();
jamf_group_hidden = jQuery(this).siblings('.jamf_group_hidden');
var id = jQuery(this).attr('attr_id');
var group_name = jQuery(this).attr('attr_group_name');
if(jQuery(this).attr("checked") == "checked"){
group_is_or_not = 1;
}else{
group_is_or_not = 0;
}
var newvalue = _quest('new');
if(newvalue == null){
newvalue = 0
}
jQuery.ajax({
type:"POST",
url: "/ajax_update_jamf_group_by_id?new="+newvalue,
cache: false,
dataType: 'json',
data: {"group_is_or_not" : group_is_or_not,"id":id,"group_name":group_name},
success: function(result)
{
if(result.status == 'ok'){
$jamf_group_hidden.html(result.data);
setTimeout(function(){
$jamf_group_hidden.fadeOut();
},1300);
//setTimeout(function(){
// location.href=location.href;
//},200);
}else {
$jamf_group_hidden.html('未能成功添加或删除'+group_name+'组');
setTimeout(function(){
jamf_static_group_hidden.fadeOut();
},1300);
}
},
error: function(){
console.log(result);
},
});
});
jQuery('.jianjianshow').fadeIn();
if(jQuery('.get_current_date_time')[0] != null)
{
curr_date_time = jQuery('.get_current_date_time').html();
curr_date_time = curr_date_time.split(" ");
specificDate = new Date(curr_date_time[0]+"T"+curr_date_time[1]);
// 每隔1秒钟更新时间
setInterval(function(){
var currentTime = specificDate;
var years = currentTime.getFullYear();
var months = currentTime.getMonth()+1;
var days = currentTime.getDate();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var seconds = currentTime.getSeconds();
//console.log(hours);
// 在10进制数前面添加一个零,以确保时间格式为24小时制
hours = hours < 10 ? "0" + hours : hours;
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
var timeString = years+"-"+months+"-"+days+" "+hours + ":" + minutes + ":" + seconds;
jQuery(".get_current_date_time").html(timeString);
specificDate.setSeconds(currentTime.getSeconds() + 1);
}, 1000);
}
//window.setInterval(function(){
// jQuery.ajax({
// type:"get",
// url: "/util/date_time.php",
// cache: false,
// dataType: 'text',
// success: function(result)
// {
// jQuery('.get_cuurent_time').html(result);
// },
// error: function(){
// console.log(result);
// },
// },1000);
//})
if(jQuery('.ipod_table_fixed_header')[0] != null)
{
jQuery('.ipod_table_fixed_header').width(jQuery('.ipod_table_main').width());
var num = jQuery('.ipod_table_fixed_header thead tr').children('th').length;
for(i = 1; i < num ; i++) {
width = jQuery('.ipod_table_main thead tr').children('th').eq(i).width();
width=width+0.9;
jQuery('.ipod_table_fixed_header thead tr').children('th').eq(i).width(width);
}
}
jQuery('.field_haved_done_checkbox').change(function(){
nid=jQuery(this).attr('attr_nid');
hidden_img = jQuery(this).siblings('img');
hidden_img.css('display','block');
hidden_text = jQuery(this).siblings('.hidden_update_haved_done');
hidden_text.css('display','block');
if(jQuery(this).prop("checked") == true){
haved_done = 1;
hidden_text.html('已处理');
}else{
haved_done = 0;
hidden_text.html('未处理');
}
setTimeout(function(){
hidden_img.fadeOut();
hidden_text.fadeOut();
},500);
jQuery.ajax({
type:"POST",
url: "/ajax_update_haved_done",
cache: false,
dataType: 'json',
data: {"nid" : nid,"haved_done":haved_done},
success: function(result)
{
},
error: function(){
console.log(result);
},
});
})
jQuery('.show-hidden-search-condiction').click(function(){
jQuery(".cs-computer-search-condiction").toggle();
if(jQuery(".cs-computer-search-condiction").css('display') == 'none'){
jQuery('.show-hidden-search-condiction').html('显示条件搜索');
}else{
jQuery('.show-hidden-search-condiction').html('隐藏条件搜索');
}
});
var time_click1=0;
var time_click2=0;
var time_click3=0;
jQuery('.b-chang-it-banggongzhe').click(function(){
time_click1 = jQuery.now();
//console.log(time_click1);
})
jQuery('.a1-2f-zixunshe').click(function(){
time_click2 = jQuery.now();
//console.log(time_click2);
})
jQuery('.b-qu-1-1f-zixunshe').click(function(){
time_click3 = jQuery.now();
//console.log(time_click3);
//要求 time_click2 > time_click1 且 time_click3 > time_click2 它们得在2秒之内连续点击
if( (time_click2 > time_click1) && (time_click3 > time_click2) && (time_click2-time_click1<2000) && (time_click3-time_click2<2000) ){
location.href='/js-user/sign_in';
}
})
time_click1_1 = 0;
time_click2_1 = 0;
time_click3_1 = 0;
jQuery('.b-chang-it-sanxia').click(function(){
if( time_click1_1 == 0){
time_click1_1 = jQuery.now();
}else if(time_click2_1 == 0){
time_click2_1 = jQuery.now();
}else if(time_click3_1 == 0){
time_click3_1 = jQuery.now();
}
if( time_click1_1> 0 && time_click2_1> 0 && time_click3_1 > 0 )
{
if( (time_click2_1 > time_click1_1) && (time_click3_1 > time_click2_1) && (time_click2_1-time_click1_1<2000) && (time_click3_1-time_click2_1<2000) ){
location.href='/js-user/sign_in';
}
else{
time_click1_1 = 0;
time_click2_1 = 0;
time_click3_1 = 0;
}
}
})
fd=true;
jQuery('.fd_sx').click(function(){
curr_sx = true;
var elementWidth = jQuery('.fd_sx').width(); // 获取元素的像素宽度
var parentWidth = jQuery('.fd_sx').parent().width(); // 获取父元素的像素宽度
if(fd){
elementWidth = elementWidth*1.2;
jQuery('.fd_sx').width(elementWidth);
if( elementWidth > parentWidth*1.7 ){
fd = false;
curr_sx = false
}
}
if(!fd && curr_sx){
elementWidth = elementWidth/1.2;
jQuery('.fd_sx').width(elementWidth);
if(elementWidth<parentWidth){
fd = true;
}
}
})
jQuery('.qiyong_jingyong_computer_in_policy').click(function(){
my=jQuery(this);
var jamf_hidden_policy_info = jQuery(this).siblings('.jamf_hidden_policy_info')
jamf_hidden_policy_info.css('display','block');
jamf_hidden_policy_info.html("<img src='/misc/throbber-active.gif' />");
var qy = jQuery(this).attr('attr_qy');
var computer_id = jQuery(this).attr('attr_computer_id');
var policy_id = jQuery(this).attr('attr_policy_id');
var newvalue = _quest('new');
if(newvalue == null){
newvalue = 0
}
jQuery.ajax({
type:"POST",
url: "/ajax_qiyong_jingyong_computer_in_policy?new="+newvalue,
cache: false,
dataType: 'json',
data: {"qy" : qy,"policy_id":policy_id,"computer_id":computer_id},
success: function(result)
{
if(result.status == 'ok'){
jamf_hidden_policy_info.html(result.data);
setTimeout(function(){
jamf_hidden_policy_info.fadeOut();
qy == 1 ? new_qy = 0 :new_qy =1
my.attr('attr_qy',new_qy);
//console.log(my.html());
my.html() == '启用' ? new_my_html = '禁用': new_my_html = '启用'
my.html(new_my_html);
my.siblings('.is_qy_jy_computer_in_policy').html() == '是' ? new_is_qy ='否' :new_is_qy = '是';
my.siblings('.is_qy_jy_computer_in_policy').html(new_is_qy);
},1300);
}else {
jamf_hidden_policy_info.html('未能成功操作');
setTimeout(function(){
jamf_hidden_policy_info.fadeOut();
},3000);
}
},
error: function(){
console.log(result);
},
});
});
/* jQuery('.send_blank_push').click(function(){
my=jQuery(this);
var jamf_hidden_send_blank_push_info = jQuery(this).siblings('.jamf_hidden_send_blank_push_info')
jamf_hidden_send_blank_push_info.css('display','block');
jamf_hidden_send_blank_push_info.html("<img src='/misc/throbber-active.gif' />");
var newvalue = _quest('new');
if(newvalue == null){
newvalue = 0
}
jQuery.ajax({
type:"POST",
url: "/ajax_send_blank_push?new="+newvalue,
cache: false,
dataType: 'json',
success: function(result)
{
if(result.status == 'ok'){
jamf_hidden_send_blank_push_info.html(result.data);
}else {
jamf_hidden_send_blank_push_info.html('未能成功操作');
/!*setTimeout(function(){
jamf_hidden_send_blank_push_info.fadeOut();
},3000);*!/
}
},
error: function(){
console.log(result);
},
});
});*/
var shangchuang_content = jQuery(".changshangshangchuan_accesses span").html();
var shangchuang_clipboard = new Clipboard('.changshangshangchuan_accesses a', {
text: function() {
return shangchuang_content;
}
});
var xiazai_content = jQuery(".changshangxiazai_accesses span").html();
var xiazai_clipboard = new Clipboard('.changshangxiazai_accesses a', {
text: function() {
return xiazai_content;
}
});
var rel_content = jQuery(".rel_accesses span").html();
var rel_clipboard = new Clipboard('.rel_accesses a', {
text: function() {
return rel_content;
}
});
//shangchuang_clipboard.on('success', function(e) {
// alert("复制成功");
//});
//shangchuang_clipboard.on('error', function(e) {
// console.log(e);
//});
jQuery('body').keyup(function(event){
var curr_pathname = window.location.pathname; // curr_url 例如 /node-admin/356 而不包含域名
const pathParts = curr_pathname.split('/');
//结果就是 // 输出: [ '', 'node-admin', '356' ]
//pathParts[0] 为 '',pathParts[1] 为 node-admin, pathParts[2] 为 356,pathParts[3]为null
if((pathParts[1].indexOf('node') == 0 ) && (!isNaN(parseInt(pathParts[2]))) && (pathParts[3] == null || pathParts[3]==''))
{
if (event.ctrlKey && event.keyCode == 220) { // 220 的反斜杠
if(jQuery('ul.tabs.primary').children('li').eq(1).children('a') !=null){
var href = jQuery('ul.tabs.primary').children('li').eq(1).children('a').attr('href');
location.href=href;
}
}
}
});
});
function ftp_renewal(loginID,serverIP)
{
jQuery.ajax({
type:"POST",
url: "/ajax_ftp_renewal",
cache: false,
dataType: 'json',
data: {"loginID" : loginID,"serverIP" : serverIP },
success: function(result)
{
if(result.status == 'ok'){
alert("给"+loginID+"续期成功,在堡垒机的serv-u上要先退出,再登录,才能看到续期的效果");
}else {
alert("给"+loginID+"续期失败");
}
location.href=location.href;
},
error: function(){
console.log(result);
},
});
}
function make_ftp_new_password(loginID,serverIP)
{
jQuery.ajax({
type:"POST",
url: "/ajax_make_ftp_new_password",
cache: false,
dataType: 'json',
data: {"loginID" : loginID,"serverIP" : serverIP },
success: function(result)
{
if(result.status == 'ok'){
alert("给"+loginID+"生成密码成功.为 "+result.password);
}else {
alert("给"+loginID+"生成密码失败");
}
// location.href=location.href;
},
error: function(){
console.log(result);
},
});
}
jQuery(document).ready(function(){
if(jQuery(".form-item-field-cs-computer-dri-und-0-value") != null && jQuery("#edit-field-cs-computer-dri-und-0-value") != null)
{
jQuery(".form-item-field-cs-computer-dri-und-0-value").add("#edit-field-cs-computer-dri-und-0-value").on('input click change', function() {
computer_dri = jQuery("#edit-field-cs-computer-dri-und-0-value").val();
jQuery.ajax({
type:"POST",
url: "/ajax_get_cs_tel_by_cs_director",
cache: false,
dataType: 'json',
data: {"computer_dri" : computer_dri},
success: function(result)
{
if(result.tel != null || result.tel != '' )
{
jQuery('#edit-field-tel-und-0-value').val(result.tel);
}
console.log(result);
},
error: function(){
console.log(result);
},
});
});
}
if(jQuery(".chuliwenti_num")[0] != null){
}
})