Commit 7f8f444c authored by Astor Bizard's avatar Astor Bizard
Browse files

Removed unused functions get/set_absolute_path in js.

parent 73796056
define(["jquery","mod_vpl/vplutil"],function(a,b){return function(){var c=this,d=null,e=null,f=c.getFileManager().readOnly,g=this.getContent;this.getContent=function(){return this.isOpen()?d.getValue():g.call(this)};var h=this.setContent;this.setContent=function(a){h.call(this,a),this.isOpen()&&d.setValue(a)};var i=this.destroy;this.destroy=function(){this.isOpen()&&d.destroy(),i.call(this)},this.setFontSize=function(a){this.isOpen()&&d.setFontSize(a)};var j=this.adjustSize;this.adjustSize=function(){return!!j.call(this)&&(d.resize(!0),!0)},this.gotoLine=function(a){this.isOpen()&&(d.gotoLine(a,0),d.scrollToLine(a,!0),d.focus())},this.setReadOnly=function(a){f=a,this.isOpen()&&d.setReadOnly(a)},this.focus=function(){if(this.isOpen()){var b=this.getTId();a(b).removeClass("ui-widget-content ui-tabs-panel"),a(b).addClass("ui-corner-bottom"),this.adjustSize(),d.focus()}},this.blur=function(){this.isOpen()&&d.blur()},this.undo=function(){this.isOpen()&&(d.undo(),d.focus())},this.redo=function(){this.isOpen()&&(d.redo(),d.focus())},this.selectAll=function(){this.isOpen()&&(d.selectAll(),d.focus())},this.hasUndo=function(){return!!this.isOpen()&&e.getUndoManager().hasUndo()},this.hasRedo=function(){return!!this.isOpen()&&e.getUndoManager().hasRedo()},this.hasSelectAll=b.returnTrue,this.hasFind=b.returnTrue,this.hasFindReplace=b.returnTrue,this.hasNext=b.returnTrue,this.find=function(){this.isOpen()&&d.execCommand("find")},this.replace=function(){this.isOpen()&&d.execCommand("replace")},this.next=function(){this.isOpen()&&d.execCommand("findnext")},this.getAnnotations=function(){return this.isOpen()?e.getAnnotations():[]},this.setAnnotations=function(a){return!!this.isOpen()&&e.setAnnotations(a)},this.clearAnnotations=function(){return!!this.isOpen()&&e.clearAnnotations()},this.langSelection=function(){if(this.isOpen()){var a=b.fileExtension(this.getFileName()),c="text";""!==a&&(c=b.langType(a)),e.setMode("ace/mode/"+c)}},this.getEditor=function(){return!!this.isOpen()&&d},this.setTheme=function(a){this.isOpen()&&d.setTheme("ace/theme/"+a)},this.check_difference=function(){var c;c="undefined"!=typeof b.get_absolute_path()?b.get_absolute_path()+"/similarity/diff_check_requested_files.php":"../similarity/diff_check_requested_files.php",a.ajax({method:"POST",url:c,data:{id:this.getCurrentIdVpl(),name:this.getFileName(),val:d.getValue()}}).done(function(a){if(a.success){a.response.diff.forEach(function(a){"="!=a.type?(d.session.removeGutterDecoration(a.ln2-1,"ace-changed"),d.session.addGutterDecoration(a.ln2-1,"ace-changed")):d.session.removeGutterDecoration(a.ln2-1,"ace-changed")})}})},this.open=function(){if(this.showFileName(),"undefined"==typeof ace)return b.loadScript(["../editor/ace9/ace.js","../editor/ace9/ext-language_tools.js"],function(){c.open()}),!1;if(this.isOpen())return d;var g=this.getFileManager(),h=this.getTId();a(h).removeClass("ui-widget-content ui-tabs-panel"),a(h).addClass("ui-corner-bottom"),ace.require("ext/language_tools"),d=ace.edit("vpl_file"+this.getId()),e=d.getSession(),d.setOptions({enableBasicAutocompletion:!0,enableSnippets:!0}),d.setValue(this.getContent()),d.setFontSize(g.getFontSize()),d.setTheme("ace/theme/"+g.getTheme()),d.$blockScrolling=1/0,d.gotoLine(0,0),d.setReadOnly(f),e.setUseSoftTabs(!0),e.setTabSize(4),e.setUndoManager(new ace.UndoManager),this.setOpen(!0),this.langSelection(),d.execCommand("replace");var i=function(){var b=a(h+" div.ace_search");b.length?(b.on("drop",g.dropHandler),a(".ace_searchbtn_close").trigger("click")):setTimeout(i,50)};this.check_difference();var j=null;d.on("change",function(){c.change(),null!==j&&clearTimeout(j),j=setTimeout(()=>{j=null,c.check_difference()},500)}),setTimeout(i,5);var k=d.onPaste;return d.onPaste=function(a){g.restrictedEdit?d.insert(g.getClipboard()):k.call(d,a)},d.on("copy",function(a){g.setClipboard(a)}),a(h).on("paste","*",g.restrictedPaste),a(h+" div.ace_content").on("drop",g.dropHandler),a(h+" div.ace_content").on("dragover",g.dragoverHandler),this.adjustSize(),d},this.close=function(){this.setOpen(!1),null!==d&&(this.setContent(d.getValue()),d.destroy(),d=null,e=null)}}});
\ No newline at end of file
define(["jquery","mod_vpl/vplutil"],function(a,b){return function(){var c=this,d=null,e=null,f=c.getFileManager().readOnly,g=this.getContent;this.getContent=function(){return this.isOpen()?d.getValue():g.call(this)};var h=this.setContent;this.setContent=function(a){h.call(this,a),this.isOpen()&&d.setValue(a)};var i=this.destroy;this.destroy=function(){this.isOpen()&&d.destroy(),i.call(this)},this.setFontSize=function(a){this.isOpen()&&d.setFontSize(a)};var j=this.adjustSize;this.adjustSize=function(){return!!j.call(this)&&(d.resize(!0),!0)},this.gotoLine=function(a){this.isOpen()&&(d.gotoLine(a,0),d.scrollToLine(a,!0),d.focus())},this.setReadOnly=function(a){f=a,this.isOpen()&&d.setReadOnly(a)},this.focus=function(){if(this.isOpen()){var b=this.getTId();a(b).removeClass("ui-widget-content ui-tabs-panel"),a(b).addClass("ui-corner-bottom"),this.adjustSize(),d.focus()}},this.blur=function(){this.isOpen()&&d.blur()},this.undo=function(){this.isOpen()&&(d.undo(),d.focus())},this.redo=function(){this.isOpen()&&(d.redo(),d.focus())},this.selectAll=function(){this.isOpen()&&(d.selectAll(),d.focus())},this.hasUndo=function(){return!!this.isOpen()&&e.getUndoManager().hasUndo()},this.hasRedo=function(){return!!this.isOpen()&&e.getUndoManager().hasRedo()},this.hasSelectAll=b.returnTrue,this.hasFind=b.returnTrue,this.hasFindReplace=b.returnTrue,this.hasNext=b.returnTrue,this.find=function(){this.isOpen()&&d.execCommand("find")},this.replace=function(){this.isOpen()&&d.execCommand("replace")},this.next=function(){this.isOpen()&&d.execCommand("findnext")},this.getAnnotations=function(){return this.isOpen()?e.getAnnotations():[]},this.setAnnotations=function(a){return!!this.isOpen()&&e.setAnnotations(a)},this.clearAnnotations=function(){return!!this.isOpen()&&e.clearAnnotations()},this.langSelection=function(){if(this.isOpen()){var a=b.fileExtension(this.getFileName()),c="text";""!==a&&(c=b.langType(a)),e.setMode("ace/mode/"+c)}},this.getEditor=function(){return!!this.isOpen()&&d},this.setTheme=function(a){this.isOpen()&&d.setTheme("ace/theme/"+a)},this.check_difference=function(){a.ajax({method:"POST",url:"../similarity/diff_check_requested_files.php",data:{id:this.getCurrentIdVpl(),name:this.getFileName(),val:d.getValue()}}).done(function(a){if(a.success){a.response.diff.forEach(function(a){"="!=a.type?(d.session.removeGutterDecoration(a.ln2-1,"ace-changed"),d.session.addGutterDecoration(a.ln2-1,"ace-changed")):d.session.removeGutterDecoration(a.ln2-1,"ace-changed")})}})},this.open=function(){if(this.showFileName(),"undefined"==typeof ace)return b.loadScript(["../editor/ace9/ace.js","../editor/ace9/ext-language_tools.js"],function(){c.open()}),!1;if(this.isOpen())return d;var g=this.getFileManager(),h=this.getTId();a(h).removeClass("ui-widget-content ui-tabs-panel"),a(h).addClass("ui-corner-bottom"),ace.require("ext/language_tools"),d=ace.edit("vpl_file"+this.getId()),e=d.getSession(),d.setOptions({enableBasicAutocompletion:!0,enableSnippets:!0}),d.setValue(this.getContent()),d.setFontSize(g.getFontSize()),d.setTheme("ace/theme/"+g.getTheme()),d.$blockScrolling=1/0,d.gotoLine(0,0),d.setReadOnly(f),e.setUseSoftTabs(!0),e.setTabSize(4),e.setUndoManager(new ace.UndoManager),this.setOpen(!0),this.langSelection(),d.execCommand("replace");var i=function(){var b=a(h+" div.ace_search");b.length?(b.on("drop",g.dropHandler),a(".ace_searchbtn_close").trigger("click")):setTimeout(i,50)};this.check_difference();var j=null;d.on("change",function(){c.change(),null!==j&&clearTimeout(j),j=setTimeout(()=>{j=null,c.check_difference()},500)}),setTimeout(i,5);var k=d.onPaste;return d.onPaste=function(a){g.restrictedEdit?d.insert(g.getClipboard()):k.call(d,a)},d.on("copy",function(a){g.setClipboard(a)}),a(h).on("paste","*",g.restrictedPaste),a(h+" div.ace_content").on("drop",g.dropHandler),a(h+" div.ace_content").on("dragover",g.dragoverHandler),this.adjustSize(),d},this.close=function(){this.setOpen(!1),null!==d&&(this.setContent(d.getValue()),d.destroy(),d=null,e=null)}}});
\ No newline at end of file
This diff is collapsed.
define(["jquery","jqueryui","mod_vpl/vplutil","mod_vpl/vplclipboard","core/log"],function(a,b,c,d,e){"undefined"==typeof c.get_absolute_path()?window.INCLUDE_URI="../editor/noVNC/include/":window.INCLUDE_URI=c.get_absolute_path()+"/editor/noVNC/include/",Util.load_scripts(["webutil.js","base64.js","websock.js","des.js","keysymdef.js","keyboard.js","input.js","display.js","jsunzip.js","rfb.js","keysym.js"]);return function(b,f){var g,h,i,j=this,k="",l="",m="",n=a("#"+b),o=a("#"+b+" canvas"),p=c.doNothing,q=!0,r=window.document.createElement("input");function s(){a(r).is(":focus")?r.blur():r.focus()}function t(a,b){h.setEntry1(b)}function u(){h.show()}function v(){j.isConnected()&&g.get_keyboard().set_focused(!0)}function w(){j.isConnected()&&g.get_keyboard().set_focused(!1)}r.style.position="absolute",r.style.left="0px",r.style.top="-10000px",r.style.width="1em",r.style.height="1ex",r.style.opacity="0",r.style.backgroundColor="transparent",r.style.borderStyle="none",r.style.outlineStyle="none",r.autocapitalize="off",r.autocomplete="off",r.autocorrect="off",r.wrap="off",r.spellcheck="false",n.append(r);var x=c.genIcon("copy","sw")+" "+f("copy"),y=c.genIcon("paste","sw")+" "+f("paste");function z(a,b,c,d){switch(m=b,b){case"normal":j.setMessage(""),j.setTitle(f("connected"));break;case"disconnect":case"disconnected":j.setTitle(f("connection_closed"));break;case"failed":j.setTitle(f("connection_fail")),e.log("VNC client: "+d);break;default:j.setMessage(""),j.setTitle(f("connecting"))}}function A(a){return a<100&&(a=100),2*Math.floor(a/2)}h=new d("vpl_dialog_vnc_clipboard",x,function(){h.setEntry1(h.getEntry1()),document.execCommand("copy")},y,function(){j.isConnected()&&g.clipboardPasteFrom(h.getEntry2())},w),o.on("click",function(a){a.target==o[0]?v():w()}),this.displayResize=function(){if(j.isConnected()){var a=n.width(),b=n.height();j.setCanvasSize(a,b),g.get_display().viewportChange(0,0,a,b)}},n.dialog({closeOnEscape:!1,autoOpen:!1,modal:!0,width:"auto",height:"auto",dialogClass:"vpl_ide vpl_vnc "+c.getThemeClass(),create:function(){i=c.setTitleBar(n,"vnc","graphic",["clipboard","keyboard"],[u,s])},focus:v,beforeClose:function(){if(q){var a=n.width(),b=n.height();q=!1,j.setCanvasSize(a,b)}},close:function(){j.disconnect()},resizeStop:function(){q=!0}}),n.css("padding","1px"),n.parent().css("z-index",2e3),this.updateTitle=function(){var a=k;""!==l&&(a+=" ("+l+")"),i.text(f("console")+": "+a)},this.setTitle=function(a){k=a,this.updateTitle()},this.setMessage=function(a){l=a,this.updateTitle()},this.connect=function(c,d,e,f,i,k){h.setEntry1(""),p=k,j.show();var l=a("#"+b+" canvas")[0];g||(g=new RFB({target:l,encrypt:c,repeaterID:"",true_color:!0,local_cursor:!0,shared:!1,view_only:!1,onUpdateState:z,onPasswordRequired:null,onClipboard:t})).set_local_cursor(g.get_display().get_cursor_uri()),e||(e=c?443:80),g.connect(d,e,f,i)},this.isOpen=function(){return n.dialog("isOpen")},this.isConnected=function(){return g&&"disconnected"!=m},this.disconnect=function(){g&&"normal"==m&&g.disconnect(),p(),h.hide()},this.getCanvasSize=function(){return o.width()+"x"+o.height()},this.setCanvasSize=function(a,b){o.width(A(a)),o.height(A(b))},this.show=function(){n.dialog("open"),n.width("auto"),n.height("auto")},j.setCanvasSize(a(window).width()-150,a(window).height()-150)}});
\ No newline at end of file
define(["jquery","jqueryui","mod_vpl/vplutil","mod_vpl/vplclipboard","core/log"],function(a,b,c,d,e){window.INCLUDE_URI="../editor/noVNC/include/",Util.load_scripts(["webutil.js","base64.js","websock.js","des.js","keysymdef.js","keyboard.js","input.js","display.js","jsunzip.js","rfb.js","keysym.js"]);return function(b,f){var g,h,i,j=this,k="",l="",m="",n=a("#"+b),o=a("#"+b+" canvas"),p=c.doNothing,q=!0,r=window.document.createElement("input");function s(){a(r).is(":focus")?r.blur():r.focus()}function t(a,b){h.setEntry1(b)}function u(){h.show()}function v(){j.isConnected()&&g.get_keyboard().set_focused(!0)}function w(){j.isConnected()&&g.get_keyboard().set_focused(!1)}r.style.position="absolute",r.style.left="0px",r.style.top="-10000px",r.style.width="1em",r.style.height="1ex",r.style.opacity="0",r.style.backgroundColor="transparent",r.style.borderStyle="none",r.style.outlineStyle="none",r.autocapitalize="off",r.autocomplete="off",r.autocorrect="off",r.wrap="off",r.spellcheck="false",n.append(r);var x=c.genIcon("copy","sw")+" "+f("copy"),y=c.genIcon("paste","sw")+" "+f("paste");function z(a,b,c,d){switch(m=b,b){case"normal":j.setMessage(""),j.setTitle(f("connected"));break;case"disconnect":case"disconnected":j.setTitle(f("connection_closed"));break;case"failed":j.setTitle(f("connection_fail")),e.log("VNC client: "+d);break;default:j.setMessage(""),j.setTitle(f("connecting"))}}function A(a){return a<100&&(a=100),2*Math.floor(a/2)}h=new d("vpl_dialog_vnc_clipboard",x,function(){h.setEntry1(h.getEntry1()),document.execCommand("copy")},y,function(){j.isConnected()&&g.clipboardPasteFrom(h.getEntry2())},w),o.on("click",function(a){a.target==o[0]?v():w()}),this.displayResize=function(){if(j.isConnected()){var a=n.width(),b=n.height();j.setCanvasSize(a,b),g.get_display().viewportChange(0,0,a,b)}},n.dialog({closeOnEscape:!1,autoOpen:!1,modal:!0,width:"auto",height:"auto",dialogClass:"vpl_ide vpl_vnc "+c.getThemeClass(),create:function(){i=c.setTitleBar(n,"vnc","graphic",["clipboard","keyboard"],[u,s])},focus:v,beforeClose:function(){if(q){var a=n.width(),b=n.height();q=!1,j.setCanvasSize(a,b)}},close:function(){j.disconnect()},resizeStop:function(){q=!0}}),n.css("padding","1px"),n.parent().css("z-index",2e3),this.updateTitle=function(){var a=k;""!==l&&(a+=" ("+l+")"),i.text(f("console")+": "+a)},this.setTitle=function(a){k=a,this.updateTitle()},this.setMessage=function(a){l=a,this.updateTitle()},this.connect=function(c,d,e,f,i,k){h.setEntry1(""),p=k,j.show();var l=a("#"+b+" canvas")[0];g||(g=new RFB({target:l,encrypt:c,repeaterID:"",true_color:!0,local_cursor:!0,shared:!1,view_only:!1,onUpdateState:z,onPasswordRequired:null,onClipboard:t})).set_local_cursor(g.get_display().get_cursor_uri()),e||(e=c?443:80),g.connect(d,e,f,i)},this.isOpen=function(){return n.dialog("isOpen")},this.isConnected=function(){return g&&"disconnected"!=m},this.disconnect=function(){g&&"normal"==m&&g.disconnect(),p(),h.hide()},this.getCanvasSize=function(){return o.width()+"x"+o.height()},this.setCanvasSize=function(a,b){o.width(A(a)),o.height(A(b))},this.show=function(){n.dialog("open"),n.width("auto"),n.height("auto")},j.setCanvasSize(a(window).width()-150,a(window).height()-150)}});
\ No newline at end of file
......@@ -196,12 +196,7 @@ define(
editor.setTheme("ace/theme/" + theme);
};
this.check_difference = function() {
var URL;
if (typeof VPLUtil.get_absolute_path() !== "undefined") {
URL = VPLUtil.get_absolute_path() + "/similarity/diff_check_requested_files.php";
} else {
URL = "../similarity/diff_check_requested_files.php";
}
var URL = "../similarity/diff_check_requested_files.php";
$.ajax({
method: "POST",
......@@ -212,7 +207,7 @@ define(
if (result.success) {
var diffData = result.response.diff;
var modified = 'ace-changed'; // CSS class.
diffData.forEach(function(diff){
diffData.forEach(function(diff) {
if(diff.type != "=") {
editor.session.removeGutterDecoration(diff.ln2-1, modified);
editor.session.addGutterDecoration(diff.ln2-1, modified);
......
......@@ -38,7 +38,6 @@ define(
'core/log',
],
function($, jqui, log) {
var absolute_path;
var VPLUtil = {};
VPLUtil.doNothing = $.noop;
......@@ -810,10 +809,6 @@ define(
};
VPLUtil.requestAction = function(action, title, data, URL) {
if (typeof VPLUtil.get_absolute_path() !== "undefined") {
URL = VPLUtil.get_absolute_path()+URL;
}
var deferred = $.Deferred();
var request = null;
var xhr = false;
......@@ -1371,13 +1366,7 @@ define(
SubmissionHighlighter.prototype.highlight = function() {
var self = this;
if (typeof ace === 'undefined') {
var URL;
if (typeof VPLUtil.get_absolute_path() !== "undefined") {
URL = VPLUtil.get_absolute_path() + '/editor/ace9/ace.js';
} else {
URL = '../editor/ace9/ace.js';
}
var URL = '../editor/ace9/ace.js';
VPLUtil.loadScript([URL], function() {
self.highlight();
......@@ -1444,13 +1433,7 @@ define(
VPLUtil.syntaxHighlight = function() {
var self = this;
if (typeof ace === 'undefined') {
var URL;
if (typeof VPLUtil.get_absolute_path() !== "undefined") {
URL = VPLUtil.get_absolute_path() + '/editor/ace9/ace.js';
} else {
URL = '../editor/ace9/ace.js';
}
var URL = '../editor/ace9/ace.js';
VPLUtil.loadScript([URL], function() {
self.syntaxHighlight();
......@@ -1479,14 +1462,6 @@ define(
scriptPath: ''
};
VPLUtil.get_absolute_path = function() {
return absolute_path;
};
VPLUtil.set_absolute_path = function(a_b) {
absolute_path = a_b;
};
VPLUtil.init = function(options) {
VPLUtil.options = {
scriptPath: ''
......
......@@ -34,11 +34,7 @@ define(
],
function($, jqui, VPLUtil, VPLClipboard, console) {
if (typeof VPLUtil.get_absolute_path() === "undefined") {
window.INCLUDE_URI="../editor/noVNC/include/";
} else {
window.INCLUDE_URI=VPLUtil.get_absolute_path()+"/editor/noVNC/include/";
}
window.INCLUDE_URI = "../editor/noVNC/include/";
Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
"keysymdef.js", "keyboard.js", "input.js", "display.js",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment