mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-08-14 05:55:56 +08:00
add
This commit is contained in:
parent
823914636c
commit
9b1ee5b098
22
diff_text.html
Normal file
22
diff_text.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title></title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<label>文本对比工具</label>
|
||||||
|
<button onclick="initUI()">折叠相同内容</button>
|
||||||
|
<button onclick="panes=2;initUI()">两文本对比</button>
|
||||||
|
<button onclick="panes=3;initUI()">三文本对比</button>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div id="view" style="height: 100%"></div>
|
||||||
|
|
||||||
|
<link rel="stylesheet" type="text/css" href="./tools/merge.css">
|
||||||
|
<script type="text/javascript" src="./tools/mergeCodeMirror.min.js"></script>
|
||||||
|
<script type="text/javascript" src="./tools/diff_text.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -167,6 +167,7 @@
|
|||||||
<button id='babel_aline'>将代码变成一行,不压缩[babel]</button>
|
<button id='babel_aline'>将代码变成一行,不压缩[babel]</button>
|
||||||
<button id='uglify'>仅变量压缩[uglify-es]</button>
|
<button id='uglify'>仅变量压缩[uglify-es]</button>
|
||||||
<button id='uglify_mini'>完全压缩脚本[uglify-es]</button>
|
<button id='uglify_mini'>完全压缩脚本[uglify-es]</button>
|
||||||
|
<button id='open_diff_text'>打开文本对比工具</button>
|
||||||
<label id='env' style="color: #FFEEEE">cilame</label>
|
<label id='env' style="color: #FFEEEE">cilame</label>
|
||||||
<br/>
|
<br/>
|
||||||
<label>source</label>
|
<label>source</label>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
var open_ast_pagetn = document.getElementById('open_ast_page')
|
var open_ast_pagetn = document.getElementById('open_ast_page')
|
||||||
|
var open_diff_texttn = document.getElementById('open_diff_text')
|
||||||
var sojsontn = document.getElementById('sojson')
|
var sojsontn = document.getElementById('sojson')
|
||||||
var obtn = document.getElementById('ob')
|
var obtn = document.getElementById('ob')
|
||||||
var jsfuckbtn = document.getElementById('jsfuck')
|
var jsfuckbtn = document.getElementById('jsfuck')
|
||||||
@ -18,6 +19,14 @@ open_ast_pagetn.addEventListener('click', function(e){
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
open_diff_texttn.addEventListener('click', function(e){
|
||||||
|
var temp = chrome.runtime.getURL('diff_text.html')
|
||||||
|
console.log(temp)
|
||||||
|
chrome.tabs.create({
|
||||||
|
url: temp
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
babel_aline.addEventListener('click', function(e){
|
babel_aline.addEventListener('click', function(e){
|
||||||
try{
|
try{
|
||||||
;(txt2||txt).value = muti_process_aline(txt.value)
|
;(txt2||txt).value = muti_process_aline(txt.value)
|
||||||
|
50
tools/diff_text.js
Normal file
50
tools/diff_text.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
var value = '';
|
||||||
|
var orig1 = '';
|
||||||
|
var orig2 = '';
|
||||||
|
var dv
|
||||||
|
var panes = 2
|
||||||
|
var highlight = false
|
||||||
|
var connect = false
|
||||||
|
var collapse = false;
|
||||||
|
function initUI() {
|
||||||
|
if (value == null) return;
|
||||||
|
var target = document.getElementById("view");
|
||||||
|
target.innerHTML = "";
|
||||||
|
if(dv){
|
||||||
|
var left = dv.leftOriginal()
|
||||||
|
var curr = dv.editor()
|
||||||
|
var right = dv.rightOriginal()
|
||||||
|
value = curr.getValue()
|
||||||
|
if (left){ orig1 = left.getValue() }
|
||||||
|
if (right){ orig2 = right.getValue() }
|
||||||
|
}
|
||||||
|
dv = CodeMirror.MergeView(target, {
|
||||||
|
value: value,
|
||||||
|
origLeft: panes == 2 ? null : orig1,
|
||||||
|
orig: orig2,
|
||||||
|
lineNumbers: true,
|
||||||
|
mode: "text/html",
|
||||||
|
highlightDifferences: highlight,
|
||||||
|
// viewportMargin: Infinity,
|
||||||
|
// connect: connect,
|
||||||
|
collapseIdentical: false,
|
||||||
|
allowEditingOriginals: true,
|
||||||
|
});
|
||||||
|
resize(dv, window.innerHeight-100)
|
||||||
|
}
|
||||||
|
|
||||||
|
initUI();
|
||||||
|
window.onresize = function(){
|
||||||
|
resize(dv, window.innerHeight-100)
|
||||||
|
}
|
||||||
|
|
||||||
|
function resize(mergeView, height) {
|
||||||
|
if (mergeView.leftOriginal()){
|
||||||
|
mergeView.leftOriginal().setSize(null, height);
|
||||||
|
}
|
||||||
|
mergeView.editor().setSize(null, height);
|
||||||
|
if (mergeView.rightOriginal()){
|
||||||
|
mergeView.rightOriginal().setSize(null, height);
|
||||||
|
}
|
||||||
|
mergeView.wrap.style.height = height + "px";
|
||||||
|
}
|
124
tools/merge.css
Normal file
124
tools/merge.css
Normal file
File diff suppressed because one or more lines are too long
8
tools/mergeCodeMirror.min.js
vendored
Normal file
8
tools/mergeCodeMirror.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user