Skip to content

Commit

Permalink
removed uneeded hack
Browse files Browse the repository at this point in the history
  • Loading branch information
jack775544 committed May 25, 2016
1 parent 4bbe705 commit 6f44568
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
5 changes: 0 additions & 5 deletions web/edit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
</div>
</div>

<%--Hack to get saving working--%>
<form id="saveForm" style="display: none;">
<textarea name="editText" title="hidden" id="hiddenArea"></textarea>
</form>

<%@include file="includes/bootstrapjs.jsp" %>
<script src="${pageContext.request.contextPath}/js/common.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/edit.js" type="text/javascript"></script>
Expand Down
13 changes: 6 additions & 7 deletions web/js/edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var editor;
var filename;
var locationPath;
$(document).ready(function(){
var editor;
var filename;
var locationPath;

var params = common.getParameters();
filename = decodeURIComponent(params.filename);
locationPath = decodeURIComponent(params.pwd) + '/' + filename;
Expand Down Expand Up @@ -65,15 +66,13 @@ $(document).ready(function(){

function saveFile(){
var fileData = editor.getValue();
$('#hiddenArea').val(fileData);
var secretForm = $('#saveForm');

$.ajax({
type: "POST",
url: common.buildUrl('./raw', {path: locationPath}),
data: {"contents": secretForm.serializeArray()[0].value},
data: {"contents": fileData},
success: function () {
alert('done');
alert('File has been saved');
}
});
}
Expand Down

0 comments on commit 6f44568

Please sign in to comment.