浏览代码

js&css自动格式化增加contentType判断

zxlie 7 年之前
父节点
当前提交
c668f53451
共有 4 个文件被更改,包括 6 次插入3 次删除
  1. 1 1
      apps/code-beautify/automatic.js
  2. 1 1
      apps/manifest.json
  3. 3 0
      apps/options/index.css
  4. 1 1
      apps/options/index.js

+ 1 - 1
apps/code-beautify/automatic.js

@@ -58,7 +58,7 @@ module.exports = (() => {
 
         let ext = location.pathname.substring(location.pathname.lastIndexOf(".") + 1).toLowerCase();
         let fileType = ({'js': 'Javascript', 'css': 'CSS'})[ext];
-        if (!fileType) {
+        if (!fileType || document.contentType.toLowerCase() === 'text/html') {
             return false;
         }
         let source = document.body.textContent;

+ 1 - 1
apps/manifest.json

@@ -1,6 +1,6 @@
 {
   "name": "WEB前端助手(FeHelper)",
-  "version": "2018.04.2418",
+  "version": "2018.04.2419",
   "manifest_version": 2,
   "default_locale": "zh_CN",
   "description": "FE助手:包括JSON格式化、二维码生成与解码、信息编解码、代码压缩、美化、页面取色、正则表达式、时间转换工具、编码规范检测、页面性能检测、Ajax接口调试",

+ 3 - 0
apps/options/index.css

@@ -1,5 +1,8 @@
 @import "../static/css/bootstrap.min.css";
 
+.wrapper {
+    width:660px;
+}
 #pageContainer label {
     font-weight: normal;
 }

+ 1 - 1
apps/options/index.js

@@ -26,7 +26,7 @@ new Vue({
             });
         },
 
-        cancel: () => {
+        cancel: function () {
             this.close();
         },