MyBB Community Forums

Full Version: put https in imgur js
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have this code 

 /* Lets build a FormData object*/
 var fd = new FormData(); // I wrote about it: https://hacks.mozilla.org/2011/01/how-to-develop-a-html5-image-uploader/
fd.append("image", file); // Append the file
var xhr = new XMLHttpRequest(); // Create the XHR (Cross-Domain XHR FTW!!!) Thank you sooooo much imgur.com
xhr.open("POST", "https://api.imgur.com/3/image.json"); // Boooom!
xhr.onload = function() {
var code = '' +'https://'+ JSON.parse(xhr.responseText).data.link + '[/img]';
$('#message, #signature, textarea[name*="value"]').data('sceditor').insert(code);
var d = document.querySelector(".sceditor-button-imgur div.imgurup");
d.className = d.className - " imgurup";
document.querySelector('input.imgur').remove();
}
// Ok, I don't handle the errors. An exercice for the reader.
xhr.setRequestHeader('Authorization', 'Client-ID '+iclid+'');
/* And now, we send the formdata */
xhr.send(fd);
};

I add https 
' +'https://'+ JSON.parse(xhr.responseText).data.link + '[/img]';

but now the form is https://http://link

how remove http://??

this is js : https://github.com/martec/myinsertbutton...ibutton.js
Hi AlexanderPep I installed this plugin made sure I changed the address in admin cp on my site hope it helps

https://community.mybb.com/mods.php?action=view&pid=450
Yes...with this plugin works because can make image proxy Big Grin