Skip to content

Commit 4441d9b

Browse files
committed
Add JavaScript error handling fc2blog#140
1 parent 800ed07 commit 4441d9b

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

public/js/admin/entry_editor.js

+19-10
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,27 @@ var addMedia = {
2222
$('#sys-add-media-dialog').dialog('option', {width: $(window).width() - 100});
2323
});
2424
},
25-
load: function(params){
26-
$('#sys-add-media-load').fadeOut('fast', function(){
27-
$('#sys-add-media-load').load(common.fwURL('Entries', 'ajax_media_load', params), function(){
28-
$('#sys-add-media-load').fadeIn('fast');
29-
$('#sys-add-media-load').find('input[type=checkbox]').on('click', function(){
30-
if ($(this).prop('checked')) {
31-
$(this).closest('li').addClass('selected');
25+
load: function (params) {
26+
$('#sys-add-media-load').fadeOut('fast', function () {
27+
$('#sys-add-media-load').load(
28+
common.fwURL('Entries', 'ajax_media_load', params),
29+
function (response, status, xhr) {
30+
if (status === "error") {
31+
alert("エラーが発生しました、ページをリロードしてください。\n" +
32+
"Loading error. Please reload page.");
33+
3234
} else {
33-
$(this).closest('li').removeClass('selected');
35+
$('#sys-add-media-load').fadeIn('fast');
36+
$('#sys-add-media-load').find('input[type=checkbox]').on('click', function () {
37+
if ($(this).prop('checked')) {
38+
$(this).closest('li').addClass('selected');
39+
} else {
40+
$(this).closest('li').removeClass('selected');
41+
}
42+
});
3443
}
35-
})
36-
});
44+
}
45+
);
3746
});
3847
},
3948
open: function(key, config){

0 commit comments

Comments
 (0)