etFunctions: a library for Joe's EditorTools

A library to be used with Joe's EditorTools for Popmundo

当前为 2015-07-13 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/10938/61693/etFunctions%3A%20a%20library%20for%20Joe%27s%20EditorTools.js

  1. // ==UserScript==
  2. // @name etFunctions: a library for Joe's EditorTools
  3. // @namespace http://popmundo-diaries.com/
  4. // Author Joe Isaacs CharId #3248185 <joe.isaacs.pm@gmail.com>
  5. // @description A library to be used with Joe's EditorTools for Popmundo
  6. // @version 1.0
  7. // ==/UserScript==
  8.  
  9. // Translation labels object
  10. var _etChanged = false;
  11.  
  12. function etBeforeUnload(){
  13. if( _etChanged === false ) return true;
  14. return confirm( "You have unsaved content. Are you sure you want to leave?" );
  15. }
  16.  
  17. function etOnSubmit(){
  18. if( _etChanged === false ) return true;
  19. return confirm( "You have unsaved content. Are you sure you want to change the article state?" );
  20. }
  21.  
  22. jisQuery( '#aspnetForm' ).attr("onsubmit","return (");
  23.  
  24.  
  25. // Return tomorrow's date at 11:00 time
  26. function etGetDate(){
  27. var currentDate = new Date();
  28. currentDate = new Date( new Date().getTime() + 24 * 60 * 60 * 1000 );
  29. var year = currentDate.getFullYear();
  30. var month = (currentDate.getMonth() + 1) < 10 ? '0' + ( currentDate.getMonth() + 1 ) : ( currentDate.getMonth() + 1 );
  31. var day = currentDate.getDate() < 10 ? '0' + currentDate.getDate() : currentDate.getDate();
  32. var hour = '11';
  33. var minutes = '00';
  34. return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes;
  35.  
  36. }
  37.  
  38. // Change the date text value if it's empty
  39. function etChangeDate( objectId ){
  40. var obj = document.getElementById( objectId );
  41. if( obj.value.length >= 1 ) return;
  42. obj.value = etGetDate();
  43. obj.setAttribute( "value", etGetDate() );
  44. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址