main.js 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. if (typeof $dora == 'undefined') {
  2. console.error('This project runs only in Dora.js.')
  3. console.error('Please visit https://dorajs.com/ for more information.')
  4. process.exit(-1)
  5. }
  6. console.info('Congratulation, your addon runs successfully!')
  7. module.exports = {
  8. formateTimeStamp(time) {
  9. var date = new Date();
  10. date.setTime(time);
  11. var year = date.getFullYear();
  12. var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  13. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  14. var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  15. var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  16. var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  17. return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
  18. },
  19. async getCookie() {
  20. this.cookie = $storage.get("cookie") == undefined ? "" && $storage.put("cookie", "") : $storage.get("cookie")
  21. this.UID = $storage.get("UID") == undefined ? [] && $storage.put("UID", []) : $storage.get("UID")
  22. this.tab_code = $storage.get("tab_code") == undefined ? 0 && $storage.put("tab_code", 0) : $storage.get("tab_code")
  23. this.top = $storage.get("top") == undefined ? false && $storage.put("top", false) : $storage.get("top")
  24. this.style = $storage.get("style") == undefined ? 0 && $storage.put("style", 0) : $storage.get("style")
  25. },
  26. cookie: "",
  27. UID: [],
  28. tab_code: 0,
  29. top: false,
  30. style: 0
  31. }