HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot//www.luokaiaa.com/sae/js/js/admin.js
$(function () {
  // 在页面加载时应用已保存的主题选择
  let savedTheme = getSavedThemePreference();
  if (savedTheme) {
    switchTheme(savedTheme);
  }
  // // 获取主题选择
  function getSavedThemePreference() {
    return localStorage.getItem('theme');
  }

  // 切换主题
  $('#day').click(function () {
    switchTheme('admin');
    saveThemePreference('admin');
  })

  $('#night').click(function () {
    switchTheme('admin2');
    saveThemePreference('admin2');
  })

  // // 切换主题
  function switchTheme(themeName) {
    $('#theme-style').attr('href', 'css/' + themeName + '.css');
  }

  // // 存储主题选择
  function saveThemePreference(themeName) {
    localStorage.setItem('theme', themeName);
  }

  // 点击标题切换input修改标题
  $('#title-h1').click(function () {
    $(this).hide()
    $('#title-input').show().focus().select()
  })

  $('#title-input').blur(function () {
    handleForm(); // 处理表单提交逻辑
  })

  function handleForm() {
    // 这里可以添加处理表单提交的逻辑
    let title = $('#title-input').val()
    if (title) {
      $.ajax({
        type: 'POST',
        url: 'title.php',
        data: { title: title },
        success: function (response) {
        },
        error: function (error) {
        }
      });
      $('#title-input').hide()
      $('#title-h1').show()
      setTimeout(function () {
        location.href = "min.php";
      }, 10);
    } else {
      alert('请输入标题')
    }
  }

  // 点击标题切换input修改标题
  $('#shym-h1').click(function () {
    $(this).hide()
    $('#shym-input').show().focus().select()
  })

  $('#shym-input').blur(function () {
    handleForm2(); // 处理表单提交逻辑
  })

  function handleForm2() {
    // 这里可以添加处理表单提交的逻辑
    let shym = $('#shym-input').val()
    if (shym) {
      $.ajax({
        type: 'POST',
        url: 'shym.php',
        data: { shym: shym },
        success: function (response) {
        },
        error: function (error) {
        }
      });
      $('#shym-input').hide()
      $('#shym-h1').show()
      setTimeout(function () {
        location.href = "min.php";
      }, 10);
    } else {
      alert('请输审核网址')
    }
  }

  // 点击标题切换input修改标题
  $('#tgym-h1').click(function () {
    $(this).hide()
    $('#tgym-input').show().focus().select()
  })

  $('#tgym-input').blur(function () {
    handleForm3(); // 处理表单提交逻辑
  })

  function handleForm3() {
    // 这里可以添加处理表单提交的逻辑
    let tgym = $('#tgym-input').val()
    if (tgym) {
      $.ajax({
        type: 'POST',
        url: 'tgym.php',
        data: { tgym: tgym },
        success: function (response) {
        },
        error: function (error) {
        }
      });
      $('#tgym-input').hide()
      $('#tgym-h1').show()
      setTimeout(function () {
        location.href = "min.php";
      }, 10);
    } else {
      alert('请输入推广')
    }
  }


  // 点击.wx时显示内部的input标签
  $('.add .wx').click(function () {
    $(this).find('input').show().focus(); // 切换显示和隐藏状态
  });

  // 点击.link时显示内部的input标签
  $('.add .link').click(function () {
    $(this).find('input').show().focus(); // 切换显示和隐藏状态
  });

  $('.add .wx, .add .link').click(function () {
    $('.addexit').show()
  })
  $('.addexit').click(function () {
    $('.add .wx input, .add .link input').hide().val('')
    $('.addexit').hide()
  })

  // 编辑按钮点击事件
  $('.edit').click(function () {
    let listItem = $(this).closest('.item');
    listItem.find('p').hide();
    listItem.find('input[type="text"]').show();
    listItem.find('.edit').hide();
    listItem.find('.editsubmit').show();
    listItem.find('.exit').show();
    listItem.find('.delete').hide();
  });

  // 提交按钮点击事件
  $('.editsubmit').click(function () {
    let listItem = $(this).closest('.item');
    listItem.find('p').show();
    listItem.find('input[type="text"]').hide();
    listItem.find('.edit').show();
    listItem.find('.exit').hide();
    listItem.find('.delete').show();
    listItem.find('.editsubmit').hide();
  });

  // 取消按钮点击事件
  $('.exit').click(function () {
    let listItem = $(this).closest('.item');
    listItem.find('p').show();
    listItem.find('input[type="text"]').hide();
    listItem.find('.edit').show();
    listItem.find('.exit').hide();
    listItem.find('.delete').show();
    listItem.find('.editsubmit').hide();
  });

  // 全部勾选
  $('.checkboxall').click(function () {
    let isChecked = $(this).prop('checked');
    if (isChecked) {
      $('.checkboxitem').prop('checked', true);
      $.ajax({
        type: 'POST',
        url: 'checkedall.php',
        data: { select: 1 },
        success: function (response) {
        },
        error: function (error) {
        }
      });
    } else {
      $('.checkboxitem').prop('checked', false);
      $.ajax({
        type: 'POST',
        url: 'checkedall.php',
        data: { select: 0 },
        success: function (response) {
        },
        error: function (error) {
        }
      });
    }
  })

  // item勾选事件
  $('.checkboxitem').click(function () {
    let isChecked = $(this).prop('checked');
    let id = $(this).data('custom-attribute');

    if (isChecked) {
      $.ajax({
        type: 'POST',
        url: 'checked.php',
        data: { select: 1, id: id },
        success: function (response) {
        },
        error: function (error) {
        }
      });
    } else {
      $.ajax({
        type: 'POST',
        url: 'checked.php',
        data: { select: 0, id: id },
        success: function (response) {
        },
        error: function (error) {
        }
      });
    }
  })
  
  // item关闭修改
  $(document).on('click', '#item-img', function () {
    $(this).siblings('#xs-p').show()
    $(this).siblings('#xs-input').hide()
  })

  // 修改像素
  // 保存修改前的像素
  var oldxs = 0;
  $('.item #xs-p').click(function () {
    oldxs = $(this).text()
    $(this).hide()
    $(this).siblings('#xs-input').show().focus().select();
  })
  
  $('.item #xs-input').blur(function () {
    editxs($(this))
  });
  function editxs(element) {
    let newxs = element.val()
    $.ajax({
      type: 'POST',
      url: 'editxs.php',
      data: { oldxs: oldxs, newxs: newxs },
      success: function (response) {
      },
      error: function (error) {
      }
    });
    element.hide()
    element.siblings('#xs-p').show()
    setTimeout(function () {
      location.href = "min.php";
    }, 10);
  }

  // 添加像素事件
  var flag = true
  $('#itemadd').click(function () {
    flag = true
    $('#xsadd-p').hide()
    $('#xsadd-input').show().focus()
    $('#xsadd-img').show()
  })
  // 取消添加(打叉按钮)
  $(document).on('click', '#xsadd-img', function () {
    flag = false
    $('#itemadd #xsadd-input').val('')
    $(this).hide()
    $('#xsadd-p').show()
    $('#xsadd-input').hide()
  })
  
  $('#xsadd-input').blur(function () {
    let xsaddInput = $(this)
    setTimeout(function() {
      if (flag) {
        addxs(xsaddInput);
      }
    }, 100)
  });
  function addxs(element) {
    let xs = element.val()
    if (xs) {
      $.ajax({
        type: 'POST',
        url: 'addxs.php',
        data: { xs: xs },
        success: function (response) {
        },
        error: function (error) {
        }
      });
      element.hide()
      element.siblings('#xsadd-img').hide()
      element.siblings('#xsadd-p').show()
      setTimeout(function () {
        location.href = "min.php";
      }, 10);
    } else {
      element.hide()
      element.siblings('#xsadd-img').hide()
      element.siblings('#xsadd-p').show()
    }
  }
})