Skip to content

Instantly share code, notes, and snippets.

@arahansa
Forked from urstory/sourceline.html
Created September 26, 2015 14:27
Show Gist options
  • Save arahansa/328e1b9522516dfed79f to your computer and use it in GitHub Desktop.
Save arahansa/328e1b9522516dfed79f to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>linenumber</title>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script>
$(function(){
$("#changeBtn").click(function() {
var source = $("#source").val();
if($("#tab").is(":checked") == true){
source = source.replace("\t", " ");
}
var lineArray = source.split("\n");
var str = '';
$.each(lineArray, function(index, line){
str += ((index < 9) ? "0" : "") + (index + 1) + " : " + line + "\n";
});
$("#destination").val(str);
});
});
</script>
</head>
<body>
<h1>소스에 라인 넘버를~</h1>
<br>
<textarea id="source" cols="70" rows="7"></textarea>
<br>
탭키를 스페이스바4개로 변환<input type="checkbox" id="tab"> <input type="button" id="changeBtn" value="소스변환"/>
<br>
<br>
<textarea id="destination" cols="70" rows="7"></textarea>
</body>
</html>
@arahansa
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment