online editor:potential fix for requests cancelled due to same origin policy
This commit is contained in:
1 parent
7b2b8155f9
commit
967a37adc4
2 files changed
+6
-16
No files matched your search
@@ -249,14 +249,7 @@ function keepalive(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function load_file(url, lineno) {
|
function load_file(url, lineno) {
|
||||||
$.ajax({
|
$.getJSON(url, function (json) {
|
||||||
type: "GET",
|
|
||||||
contentType: 'application/json',
|
|
||||||
cache: false,
|
|
||||||
dataType: 'json',
|
|
||||||
url: url,
|
|
||||||
timeout: 1000,
|
|
||||||
success: function (json) {
|
|
||||||
if(typeof (json['plain_html']) !== undefined) {
|
if(typeof (json['plain_html']) !== undefined) {
|
||||||
if($('#' + json['id']).length === 0 || json['force'] === true) {
|
if($('#' + json['id']).length === 0 || json['force'] === true) {
|
||||||
// Create a tab and put the code in it
|
// Create a tab and put the code in it
|
||||||
@@ -271,11 +264,10 @@ function load_file(url, lineno) {
|
|||||||
}
|
}
|
||||||
$("a[href='#" + json['id'] + "']").trigger('click', lineno);
|
$("a[href='#" + json['id'] + "']").trigger('click', lineno);
|
||||||
}
|
}
|
||||||
},
|
}).fail(function() {
|
||||||
error: function (x) {
|
|
||||||
on_error();
|
on_error();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_font(editor, incr) {
|
function set_font(editor, incr) {
|
||||||
|
|||||||
@@ -199,11 +199,6 @@ $(document).on('click', 'a.font_button', function (e) {
|
|||||||
});
|
});
|
||||||
current_font_incr = (new_incr !== 0) ? current_font_incr + new_incr : 0;
|
current_font_incr = (new_incr !== 0) ? current_font_incr + new_incr : 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
{{if len(request.args) > 1:}}
|
|
||||||
load_file('{{=URL(f='edit', args=request.args, vars=request.get_vars)}}', {{=request.vars.lineno or 1}});
|
|
||||||
{{pass}}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{block sectionclass}}edit{{end}}
|
{{block sectionclass}}edit{{end}}
|
||||||
@@ -305,6 +300,9 @@ $(document).ready(function() {
|
|||||||
$('#files').css('left', '-'+ow+'px');
|
$('#files').css('left', '-'+ow+'px');
|
||||||
$.web2py.trap_form('url', 'form');
|
$.web2py.trap_form('url', 'form');
|
||||||
$('#form form').addClass('no_trap'); // Let to reuse the same form
|
$('#form form').addClass('no_trap'); // Let to reuse the same form
|
||||||
|
{{if len(request.args) > 1:}}
|
||||||
|
load_file('{{=URL(f='edit', args=request.args, vars=request.get_vars)}}', {{=request.vars.lineno or 1}});
|
||||||
|
{{pass}}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<!-- Typeahead scripts here so the page load faster -->
|
<!-- Typeahead scripts here so the page load faster -->
|
||||||
|
|||||||
Reference in new issue
Block a user