Skip to content

Commit 5b18b9c

Browse files
committed
remove other image dialog
1 parent ef7a17b commit 5b18b9c

File tree

1 file changed

+0
-85
lines changed

1 file changed

+0
-85
lines changed

sox.enhanced_editor.js

-85
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var enhancedEditor = {
1818
$('[id^="enhancedEditor"]').not('#sox-settings-dialog input').remove();
1919
var s = '#'+wmd; //s is the selector we pass onto each function so the action is applied to the correct textarea (and not, for example the 'add answer' textarea *and* the 'edit' textarea!)
2020
enhancedEditor.startInsertLink(s);
21-
enhancedEditor.startInsertImages(s);
2221
enhancedEditor.betterTabKey(s);
2322
enhancedEditor.keyboardShortcuts(s);
2423

@@ -102,53 +101,6 @@ var enhancedEditor = {
102101
}, 3000);
103102
},
104103

105-
startInsertImages: function(s) {
106-
var imagesDiv = "<div id='enhancedEditor-insertImageDialog' class='wmd-prompt-dialog enhancedEditor-centered' style='position:fixed; display:none;'> \
107-
<span class='enhancedEditor-closeDialog'>x</span>\
108-
<h2>Insert image</h2>\
109-
<div class='addImage'>\
110-
<div class='addOwnImage-container'>Select file:\
111-
<input class='ownImage' type='file' />\
112-
<input class='go' id='ownGoImage' type='button' value='insert' />\
113-
<label class='enhancedEditor-asLinkContainer'><input type='checkbox' id='enhancedEditor-imageAsLink'>Insert smaller image with link to bigger?</label>\
114-
</div>\
115-
<br>\
116-
<hr class='or'>\
117-
<div class='addLinkImage-container'>Enter URL:\
118-
<input class='URLImage' type='url' value='http://' />\
119-
<input class='go' id='goImage' type='button' value='insert' />\
120-
<label class='enhancedEditor-asLinkContainer'><input type='checkbox' id='enhancedEditor-imageAsLink'>Insert smaller image with link to bigger?</label>\
121-
</div>\
122-
</div>\
123-
</div>";
124-
$('body').append(imagesDiv);
125-
126-
setTimeout(function() {
127-
$('#wmd-image-button > span').click(function(e) {
128-
$('#enhancedEditor-insertImageDialog').show(500);
129-
setTimeout(function () {
130-
query = $(s).getSelection();
131-
132-
$('#ownGoImage').click(function() {
133-
$check = $(this).next();
134-
enhancedEditor.uploadToImgur('file', $(this).prev(), function(url) {
135-
enhancedEditor.addImageLink(query, url, $check, s);
136-
});
137-
});
138-
$('#goImage').click(function() {
139-
$check = $(this).next();
140-
enhancedEditor.uploadToImgur('url', $(this).prev(), function(url) {
141-
enhancedEditor.addImageLink(query, url, $check, s);
142-
});
143-
});
144-
}, 1000);
145-
e.stopPropagation();
146-
e.preventDefault();
147-
return false;
148-
});
149-
}, 3000);
150-
},
151-
152104
betterTabKey: function(s) {
153105
$(s).on('keydown', function(e) {
154106
if (e.which === 9) { //http://stackoverflow.com/a/25430815/3541881
@@ -284,43 +236,6 @@ var enhancedEditor = {
284236
});
285237
},
286238

287-
uploadToImgur: function(type, $fileData, callback) {
288-
var formData = new FormData(),
289-
data = '';
290-
if (type=='file') {
291-
formData.append("image", $fileData[0].files[0]);
292-
} else {
293-
data = $fileData.val();
294-
}
295-
296-
$.ajax({
297-
url: "https://api.imgur.com/3/image",
298-
type: "POST",
299-
headers: {
300-
'Authorization': 'Client-ID 1ebf24e58286774'
301-
},
302-
data: (type=='file' ? formData : data),
303-
success: function(response) {
304-
callback(response.data.link);
305-
},
306-
processData: false,
307-
contentType: false
308-
});
309-
310-
},
311-
312-
addImageLink: function(query, url, $check, s) {
313-
if($check.find('input').is(':checked')) {
314-
urlsplit = url.split('/')[3].split('.');
315-
urlToUse = 'http://i.imgur.com/'+urlsplit[0]+'m.'+urlsplit[1];
316-
$(s).replaceSelectedText('[!['+query.text+']('+urlToUse+')]('+url+')\n\n<sub>click image for larger variant</sub>');
317-
} else {
318-
$(s).replaceSelectedText('!['+query.text+']('+url+')');
319-
}
320-
$('#enhancedEditor-insertImageDialog').hide();
321-
enhancedEditor.refreshPreview();
322-
},
323-
324239
refreshPreview: function() {
325240
SOHelper.StackExchange().MarkdownEditor.refreshAllPreviews();
326241
}

0 commit comments

Comments
 (0)