index.html 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <!DOCTYPE html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  4. <title>化学</title>
  5. <script type="text/javascript" src="/js/jquery.min.js" crossorigin="anonymous"></script>
  6. <link rel="stylesheet" href="/css/bootstrap.min.css" crossorigin="anonymous">
  7. <script type="text/javascript" src="/js/bootstrap.min.js" crossorigin="anonymous"></script>
  8. <link rel="stylesheet" href="/css/style.css">
  9. <link rel="preconnect" href="https://fonts.gstatic.com">
  10. <link href="https://fonts.loli.net/css2?family=Anonymous+Pro:ital,wght@0,400;0,700;1,400;1,700
  11. &family=Noto+Serif+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet">
  12. <style>
  13. .well {
  14. padding: 10px;
  15. border: 1px solid rgb(173, 173, 173);
  16. background-color: #f5f5f5;
  17. margin-top: 5px;
  18. min-height: 160px;
  19. border-radius: 5px;
  20. width: 100%;
  21. overflow-x: auto;
  22. overflow-y: auto;
  23. }
  24. pre {
  25. overflow-x: auto;
  26. overflow-y: auto;
  27. white-space: pre-wrap;
  28. }
  29. .btn-default:focus,
  30. .btn-default:focus-visible,
  31. .btn-default:focus-within,
  32. .btn-default:active:focus {
  33. outline: 4px dashed rgba(59, 86, 100, 0.5);
  34. }
  35. .btn-default:hover {
  36. outline: 10px double rgba(59, 86, 100, 0.5);
  37. z-index: 4 !important
  38. }
  39. .btn.disabled {
  40. cursor: default;
  41. pointer-events: none;
  42. z-index: 0;
  43. }
  44. .text-muted a {
  45. color: rgb(173, 173, 173);
  46. }
  47. a {
  48. transition-duration: 300ms;
  49. }
  50. a:hover {
  51. box-shadow: inset 1px 1px 6px rgba(59, 86, 100, 0.3);
  52. }
  53. .label {
  54. padding: .2em .4em .2em;
  55. font-family: 'Courier New';
  56. display: inline-block;
  57. transform: translateY(-2px);
  58. }
  59. .MathJax {
  60. color: midnightblue;
  61. }
  62. .result {
  63. color: slategrey;
  64. border-bottom: 1px solid;
  65. border-image: linear-gradient(to right, transparent, rgba(143, 65, 233, 0.5), #578aef, transparent) 1;
  66. }
  67. .result:hover {
  68. background-color: rgba(159, 186, 200, 0.1);
  69. }
  70. .glyphicon-share-alt {
  71. transform: rotateX(180deg);
  72. }
  73. </style>
  74. <script id="MathJax-script" src="https://cdn.bootcss.com/mathjax/3.2.2/es5/tex-mml-chtml.js"></script>
  75. <script src="/js/chem.js"></script>
  76. </head>
  77. <body>
  78. <div class="row">
  79. <div class="col-lg-2 col-md-2 col-xs-12">
  80. <a class="btn btn-info" href="/"><i class="glyphicon glyphicon-home" aria-hidden="true"></i>&nbsp;返回</a>
  81. <hr>
  82. <button type="button" class="btn btn-default active" data-toggle="button" onclick="preview=!preview" id="preview" title="性能降低时关闭">实时预览</button>
  83. <hr>
  84. <p>小提示:<br><code>&lt;e+&gt;</code>、<code>&lt;2e-&gt;</code> 用于标注电荷,<code>.</code> 用于代替水合物等中间的点。输入 ! 快速查询并导入结果。</p>
  85. </div>
  86. <div class="col-lg-8 col-md-10 col-xs-12">
  87. <div class="input-group">
  88. <!-- <span class="input-group-btn">
  89. <button type="button" class="btn btn-default" onclick="balUp()" id="balShare" title="导入配平结果"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></button>
  90. </span> -->
  91. <input id="balInput" type="text" class="form-control" oninput="input()" autocomplete="off">
  92. <span class="input-group-btn">
  93. <button type="button" class="btn btn-default" onclick="balance()" id="balBtn">配平</button>
  94. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
  95. <span class="caret"></span>
  96. <span class="sr-only">切换下拉菜单</span>
  97. </button>
  98. <ul class="dropdown-menu" role="menu">
  99. <li class="dropdown-header">功能</li>
  100. <li><a href="#" onclick="setBal()">配平</a></li>
  101. <li><a href="#" onclick="setWeigh()">相对质量</a></li>
  102. <li><a href="#" onclick="setWeigh2()" data-toggle="tooltip" data-placement="left" title="四位有效数字">相对质量*</a></li>
  103. <li class="divider"></li>
  104. <li><a href="/chemist" data-toggle="tooltip" data-placement="left" title="将打开新页面">配平接口</a>
  105. </li>
  106. </ul>
  107. </span>
  108. </div>
  109. <hr>
  110. <div class="well frame">
  111. </div>
  112. <hr>
  113. <div class="input-group">
  114. <span class="input-group-btn">
  115. <button type="button" class="btn btn-default"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></button>
  116. <button type="button" class="btn btn-default" data-toggle="button" onclick="qryToggleMatch()" id="qryMatch">匹配分子</button>
  117. </span>
  118. <input id="qryInput" type="text" class="form-control qryInput" autocomplete="off" oninput="input2()">
  119. <span class="input-group-addon qryInputHidable" style="display:none">=</span>
  120. <input id="qryInput2" type="text" class="form-control qryInput qryInputHidable" style="display:none" autocomplete="off" oninput="input2()">
  121. <span class="input-group-btn">
  122. <button type="button" class="btn btn-default" onclick="query()" id="qryBtn">查询方程式</button>
  123. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
  124. <span class="caret"></span>
  125. <span class="sr-only">切换下拉菜单</span>
  126. </button>
  127. <ul class="dropdown-menu" role="menu">
  128. <li class="dropdown-header">功能</li>
  129. <li><a href="#1" onclick="setQryEq()">查询方程式</a></li>
  130. <li><a href="#1" onclick="setQryEq2()" data-toggle="tooltip" data-placement="left" title="限制等号左右">查询方程式*</a></li>
  131. <!-- <li><a href="#4" onclick="setQryMo()">查询分子</a></li> -->
  132. <li class="divider"></li>
  133. <li><a href="#5" onclick="setAddEq()">上传方程式</a></li>
  134. <!-- <li><a href="#5" onclick="setAddMo()">上传分子</a></li> -->
  135. <li class="divider"></li>
  136. <li><a href="#1" onclick="setUpdEq()">修改方程式</a></li>
  137. <!-- <li><a href="#4" onclick="setUpdMo()">修改分子</a></li> -->
  138. </li>
  139. </ul>
  140. </span>
  141. </div>
  142. <div class="input-group addInput">
  143. <span id="addId"><span class="input-group-addon">id</span>
  144. <input type="text" class="form-control" id="addIdText" oninput="inputId()" autocomplete="off" placeholder="1">
  145. </span>
  146. <span><span class="input-group-addon">反应条件</span>
  147. <input id="addCondition" type="text" class="form-control" autocomplete="off" placeholder="加热;高温;点燃;通电;光照;MnO2">
  148. </span>
  149. <span><span class="input-group-addon">描述</span>
  150. <textarea id="addDescription" type="text" class="form-control" autocomplete="off" style="resize:vertical"></textarea>
  151. </span>
  152. <span class="input-group-addon">:)</span>
  153. </div>
  154. <pre class="ok" style="font-family: 'Consolas'"></pre>
  155. <hr>
  156. <div class="well frame">
  157. <span id="qryInputRender"></span>
  158. </div>
  159. </div>
  160. <div class="col-lg-2 col-md-12 col-xs-12">
  161. <button class="btn btn-default" onclick="$('.help').toggle(300);$('.helpicon').toggleClass('glyphicon-arrow-down')"><i class="glyphicon glyphicon-question-sign helpicon"></i></button>
  162. </div>
  163. </div>
  164. <div class="row help" style="display:none;">
  165. <p>忽然觉得可能多数人看到这个界面会一脸懵,所以我还是写个说明吧。</p>
  166. <p>上下两个面板都可以用文字直接输入化学式,上面那个负责运算,下面那个负责数据库的交互。</p>
  167. <p>具体怎么操作相信大家都能看懂,用最右边的箭头可以切换功能,然后输入化学式,按下按钮,或者回车也行。至于相对质量,由于不需要多少算力,它是实时更新的。</p>
  168. <p>我运用了聪明绝顶的正则表达式(也就是那一串火星文),保证了查询方程式时,只要所有分子完全匹配,无论顺序都能查得到。你也可以改为只查包含某种元素的化学式,按左边的按钮就行。</p>
  169. <p>我目前只录入了高一上学期讲的一些式子,你要是吃饱了闲着没事干也可以帮我录入。查到的方程式带着的数字就是它的 id,修改的时候用得到。</p>
  170. </div>
  171. </body>